2 using System.Collections.Generic;
9 namespace droid.Runtime.Prototyping.Sensors.Transform {
13 [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
14 +
"PositionObserver2D" 15 + SensorComponentMenuPath._Postfix)]
20 [Header(
"Observation", order = 103)]
22 Vector2 _2_d_position;
28 [Header(
"Specific", order = 102)]
35 public Vector2 ObservationValue {
get {
return this._2_d_position; }
set { this._2_d_position = value; } }
40 public Space2 DoubleSpace {
get {
return this._position_space; } }
48 switch (this._dim_combination) {
50 vector2_pos =
new Vector2(position.x, position.y);
53 vector2_pos =
new Vector2(position.x, position.z);
56 vector2_pos =
new Vector2(position.y, position.z);
58 default:
throw new ArgumentOutOfRangeException();
61 this._2_d_position = this.DoubleSpace.IsNormalised
69 public override IEnumerable<float> FloatEnumerable {
70 get {
return new[] {this._2_d_position.x, this._2_d_position.y}; }
77 if (this.ParentEnvironment != null && this.observation_space ==
ObservationSpace.Environment_) {
78 this.SetPosition(this.ParentEnvironment.TransformPoint(
this.transform.position));
80 this.SetPosition(this.transform.localPosition);
82 this.SetPosition(this.transform.position);
93 var position = this.transform.position;
94 switch (this._dim_combination) {
96 Debug.DrawLine(position, position + Vector3.right * 2, Color.green);
97 Debug.DrawLine(position, position + Vector3.up * 2, Color.red);
100 Debug.DrawLine(position, position + Vector3.right * 2, Color.green);
101 Debug.DrawLine(position, position + Vector3.forward * 2, Color.red);
105 Debug.DrawLine(position, position + Vector3.up * 2, Color.green);
106 Debug.DrawLine(position, position + Vector3.forward * 2, Color.red);
109 Gizmos.DrawIcon(position,
"console.warnicon",
true);
Vector2 ClipNormaliseRound(Vector2 v)