![]() |
Creature Control for Unity v0.1
|
Component to control the locomotion of a Creature.
Using this component the creature can walk around with 3 degrees of freedom:
Public Types | |
| enum | Mode { Transform } |
| Mode for controlling the creature transform. More... | |
Public Member Functions | |
| void | Move (Vector2 linear, float angular) |
| Move the creature. | |
| void | MoveByAnimator (Vector2 linear, float angular) |
| Move the creature using the animator directly. | |
| virtual void | MoveTransform (Vector2 linear, float angular) |
| Move the creature using the Rigidbody or Transform. | |
| virtual void | MoveKinematicRigidbody (Vector2 linear, float angular) |
| Move the creature for a kinematic Rigidbody. | |
| virtual void | MoveDynamicRigidbody (Vector2 linear, float angular) |
| Move the creature for a non-kinematic Rigidbody. | |
Public Attributes | |
| Mode | movedBy = Mode.Transform |
| Set the mode for controlling animations and movements. | |
| InputActionReference | moveAction |
| The input action for linear motion. | |
| InputActionReference | rotateAction |
| The input action for rotation motion. | |
| float | maxLinearSpeed = 1 |
| The maximum linear locomotion speed in meters/second. | |
| float | maxAngularSpeed = 90 |
| The maximum angular locomotion speed in degrees/second. | |
Protected Attributes | |
| Creature | creature |
| The creature to control. | |
| Rigidbody | rigidbody |
| The (optional) rigidbody of the creature. | |
| Animator | animator |
| The (optional) animator for the animations. | |
Mode for controlling the creature transform.
| Enumerator | |
|---|---|
| Transform | Animations move the transform (currently unsupported). Transform movements drive the animations |
| void Creatures.CreatureController.Move | ( | Vector2 | linear, |
| float | angular ) |
Move the creature.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
| void Creatures.CreatureController.MoveByAnimator | ( | Vector2 | linear, |
| float | angular ) |
Move the creature using the animator directly.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
This bypasses the CreatureController.movedBy parameter and will also work when a non-kinematic Rigidbody is present
|
virtual |
Move the creature using the Rigidbody or Transform.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
This function needs to be called from the Update() loop
Reimplemented in Creatures.Insects.InsectController.
|
virtual |
Move the creature for a kinematic Rigidbody.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
This function needs to be called in the FixedUpdate() loop
Reimplemented in Creatures.Insects.InsectController.
|
virtual |
Move the creature for a non-kinematic Rigidbody.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
This function needs to be called in the FixedUpdate() loop