6 namespace droid.Runtime.Prototyping.Actuators {
10 [AddComponentMenu(ActuatorComponentMenuPath._ComponentMenuPath
11 +
"Rigidbody3DofActuator" 12 + ActuatorComponentMenuPath._Postfix)]
13 [RequireComponent(typeof(Rigidbody))]
23 protected ForceMode _ForceMode = ForceMode.Force;
28 protected Space _Relative_To = Space.Self;
49 public override string PrototypingTypeName {
get {
return "Rigidbody"; } }
54 protected override void Setup() { this._Rigidbody = this.GetComponent<Rigidbody>(); }
60 this._x = this.Identifier +
"X_";
61 this._y = this.Identifier +
"Y_";
62 this._z = this.Identifier +
"Z_";
63 if (this._Angular_Actuators) {
64 this._x = this.Identifier +
"RotX_";
65 this._y = this.Identifier +
"RotY_";
66 this._z = this.Identifier +
"RotZ_";
82 if (!this._Angular_Actuators) {
84 if (this._Relative_To == Space.World) {
85 this._Rigidbody.AddForce(Vector3.left * motion.
Strength,
this._ForceMode);
87 this._Rigidbody.AddRelativeForce(Vector3.left * motion.
Strength,
this._ForceMode);
90 if (this._Relative_To == Space.World) {
91 this._Rigidbody.AddForce(Vector3.up * motion.
Strength,
this._ForceMode);
93 this._Rigidbody.AddRelativeForce(Vector3.up * motion.
Strength,
this._ForceMode);
96 if (this._Relative_To == Space.World) {
97 this._Rigidbody.AddForce(Vector3.forward * motion.
Strength,
this._ForceMode);
99 this._Rigidbody.AddRelativeForce(Vector3.forward * motion.
Strength,
this._ForceMode);
104 if (this._Relative_To == Space.World) {
105 this._Rigidbody.AddTorque(Vector3.left * motion.
Strength,
this._ForceMode);
107 this._Rigidbody.AddRelativeTorque(Vector3.left * motion.
Strength,
this._ForceMode);
110 if (this._Relative_To == Space.World) {
111 this._Rigidbody.AddTorque(Vector3.up * motion.
Strength,
this._ForceMode);
113 this._Rigidbody.AddRelativeTorque(Vector3.up * motion.
Strength,
this._ForceMode);
116 if (this._Relative_To == Space.World) {
117 this._Rigidbody.AddTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
119 this._Rigidbody.AddRelativeTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
override void RegisterComponent()
override void InnerApplyMotion(IMotion motion)