8 namespace droid.Runtime.Prototyping.Actuators {
12 [AddComponentMenu(ActuatorComponentMenuPath._ComponentMenuPath
14 + ActuatorComponentMenuPath._Postfix)]
15 [RequireComponent(typeof(Rigidbody))]
31 public override string PrototypingTypeName {
get {
return "TargetRigidbody"; } }
36 public Single MovementSpeed {
get;
set; }
41 public Single RotationSpeed {
get;
set; }
51 public void Step() { this.OnStep(); }
61 protected override void Setup() {
62 this._Rigidbody = this.GetComponent<Rigidbody>();
64 this._movement = this.Identifier +
"Movement_";
65 this._turn = this.Identifier +
"Turn_";
77 this._parent_environment =
81 if (this._parent_environment != null) {
83 this._parent_environment.
StepEvent += this.Step;
100 void ApplyRotation(
float rotation_change = 0f) { this.RotationSpeed = rotation_change; }
102 void ApplyMovement(
float movement_change = 0f) { this.MovementSpeed = movement_change; }
105 this._Rigidbody.velocity = Vector3.zero;
106 this._Rigidbody.angularVelocity = Vector3.zero;
109 var movement = this.MovementSpeed * Time.deltaTime * this.transform.forward;
110 this._Rigidbody.MovePosition(this._Rigidbody.position + movement);
113 var turn = this.RotationSpeed * Time.deltaTime;
114 var turn_rotation = Quaternion.Euler(0f, turn, 0f);
115 this._Rigidbody.MoveRotation(this._Rigidbody.rotation * turn_rotation);
override void InnerApplyMotion(IMotion motion)
override void RegisterComponent()
override void RegisterComponent()