|
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 { Animator , Transform , External } |
| 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. | |
| void | MoveByTransform (Vector2 linear, float angular) |
| Move the creature using the Rigidbody or Transform. | |
| void | MoveExternal () |
| Move the creature by moving the Transform directly. | |
Public Attributes | |
| Mode | movedBy |
| 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 | speed = 1 |
| The maximum linear locomotion speed in m/s. | |
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 | |
|---|---|
| Animator | Animations move the transform. |
| Transform | Transform movements drive the animations. |
| External | The movements are done externally, animations will follow. |
| 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 |
If the creature has a non-Kinematic Rigidbody the Mode.External is always chosen
| 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
| void Creatures.CreatureController.MoveByTransform | ( | Vector2 | linear, |
| float | angular ) |
Move the creature using the Rigidbody or Transform.
| linear | The desired 2D linear velocity |
| angular | The desired angular velocity around the vertical axis |
If a Rigidbody is present, Rigidbody::Move is used. If not, Transform::Translate and Transform::Rotate are used
When using a Rigidbody, call this function from UnityEngine::FixedUpdate.