6 namespace droid.Runtime.Prototyping.Actuators {
10 [AddComponentMenu(ActuatorComponentMenuPath._ComponentMenuPath
12 + ActuatorComponentMenuPath._Postfix)]
13 [RequireComponent(typeof(Rigidbody))]
18 protected ForceMode _ForceMode = ForceMode.Force;
23 protected Space _Relative_To = Space.Self;
38 public override string PrototypingTypeName {
get {
return "Rigidbody"; } }
43 protected override void Setup() {
44 this._Rigidbody = this.GetComponent<Rigidbody>();
46 this._x = this.Identifier +
"X_";
47 this._y = this.Identifier +
"Y_";
48 this._z = this.Identifier +
"Z_";
49 this._rot_x = this.Identifier +
"RotX_";
50 this._rot_y = this.Identifier +
"RotY_";
51 this._rot_z = this.Identifier +
"RotZ_";
77 if (this._Relative_To == Space.World) {
79 this._Rigidbody.AddForce(Vector3.left * motion.
Strength,
this._ForceMode);
81 this._Rigidbody.AddForce(Vector3.up * motion.
Strength,
this._ForceMode);
83 this._Rigidbody.AddForce(Vector3.forward * motion.
Strength,
this._ForceMode);
85 this._Rigidbody.AddTorque(Vector3.left * motion.
Strength,
this._ForceMode);
87 this._Rigidbody.AddTorque(Vector3.up * motion.
Strength,
this._ForceMode);
89 this._Rigidbody.AddTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
91 }
else if (this._Relative_To == Space.Self) {
93 this._Rigidbody.AddRelativeForce(Vector3.left * motion.
Strength,
this._ForceMode);
95 this._Rigidbody.AddRelativeForce(Vector3.up * motion.
Strength,
this._ForceMode);
97 this._Rigidbody.AddRelativeForce(Vector3.forward * motion.
Strength,
this._ForceMode);
99 this._Rigidbody.AddRelativeTorque(Vector3.left * motion.
Strength,
this._ForceMode);
101 this._Rigidbody.AddRelativeTorque(Vector3.up * motion.
Strength,
this._ForceMode);
103 this._Rigidbody.AddRelativeTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
106 Debug.LogWarning($
"Not applying force in space {this._Relative_To}");
override void RegisterComponent()
override void InnerApplyMotion(IMotion motion)