6 namespace droid.Runtime.Prototyping.Actuators {
10 [AddComponentMenu(ActuatorComponentMenuPath._ComponentMenuPath
11 +
"Rigidbody1DofActuator" 12 + ActuatorComponentMenuPath._Postfix)]
13 [RequireComponent(typeof(Rigidbody))]
17 [Header(
"General", order = 101)]
24 protected ForceMode _ForceMode = ForceMode.Force;
29 protected Space _Relative_To = Space.Self;
38 public override string PrototypingTypeName {
get {
return "Rigidbody" + this._Axis_Of_Motion; } }
42 protected override void Setup() { this._Rigidbody = this.GetComponent<Rigidbody>(); }
49 switch (this._Axis_Of_Motion) {
51 if (this._Relative_To == Space.World) {
52 this._Rigidbody.AddForce(Vector3.left * motion.
Strength,
this._ForceMode);
54 this._Rigidbody.AddRelativeForce(Vector3.left * motion.
Strength,
this._ForceMode);
59 if (this._Relative_To == Space.World) {
60 this._Rigidbody.AddForce(Vector3.up * motion.
Strength,
this._ForceMode);
62 this._Rigidbody.AddRelativeForce(Vector3.up * motion.
Strength,
this._ForceMode);
67 if (this._Relative_To == Space.World) {
68 this._Rigidbody.AddForce(Vector3.forward * motion.
Strength,
this._ForceMode);
70 this._Rigidbody.AddRelativeForce(Vector3.forward * motion.
Strength,
this._ForceMode);
75 if (this._Relative_To == Space.World) {
76 this._Rigidbody.AddTorque(Vector3.left * motion.
Strength,
this._ForceMode);
78 this._Rigidbody.AddRelativeTorque(Vector3.left * motion.
Strength,
this._ForceMode);
83 if (this._Relative_To == Space.World) {
84 this._Rigidbody.AddTorque(Vector3.up * motion.
Strength,
this._ForceMode);
86 this._Rigidbody.AddRelativeTorque(Vector3.up * motion.
Strength,
this._ForceMode);
91 if (this._Relative_To == Space.World) {
92 this._Rigidbody.AddTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
94 this._Rigidbody.AddRelativeTorque(Vector3.forward * motion.
Strength,
this._ForceMode);
98 case Axis.Dir_x_:
break;
99 case Axis.Dir_y_:
break;
100 case Axis.Dir_z_:
break;
102 throw new ArgumentOutOfRangeException();
override void InnerApplyMotion(IMotion motion)