Creature Control for Unity v0.1
Loading...
Searching...
No Matches
Creatures.Creature Class Reference

Description

The base class for all creatures.

Unity Properties

In order to control various parts of the creature, certain bones need to be identified in the Configuration section. Bones which are children of a bone listed in this section are detected automatically.

The child bones can be inspected by folding out the parent bone section

It is always possible to manually identify these bones or to override the automatically detected bones by editing the fields of the child bones.

Bones are identified by settings the parameters in the Configuration section to refer to bones in the armature or rig of the model.

Note
The configuration parameters should not point to the bones in the 'Target Rig' but to those in the model.
  • Configuration
    • Head (Creature.head) This shall point to the head bone transform
  • Creature.animator
Inheritance diagram for Creatures.Creature:
Creatures.Insects.Insect

Public Member Functions

virtual Quaternion GetStdOrientation ()
 Get the standard orientation of the model.
virtual void Update ()
 Update the creature.
virtual void UpdatePose ()
 Update the bones of the creature's rig from the target rig pose.
virtual void Animate ()
 Update the animator parameters based on the linear and angular velocity.

Static Public Member Functions

static Dictionary< string, Transform > GenerateBoneDictionary (Transform root)
 Get all protential bones in the model.

Public Attributes

Transform model
 The (hopefully rigged) 3D model of the creature.
Head head
 The head of the creature.
Torso torso
 The torso of the creature.
Tail tail
 The abdomen of the insect.
Rig rig
 The target bones rig.
Vector3 toCreatureTranslation
 The positional different between the target rig and model root.
Quaternion toCreatureRotation
 The rotational difference between the target rig and the model root.
Animator animator
 The animator of the creature.
Dictionary< string, Transform > boneDictionary
 A dictrionary of all (possible bones) indexed by their names.

Protected Member Functions

virtual Vector3 CalculateLinearVelocityWorld (float deltaTime)
 Calculate the linear velocity in world space.
virtual float CalculateAngularVelocityWorld (float deltaTime)
 Calculate the angular velocity around the verical axis in world space.

Protected Attributes

Vector3 previousPosition
 The position in the previous update.

Static Protected Attributes

static readonly int ForwardParameter = Animator.StringToHash("Forward")
 Animator parameter for forward/backward motion.
static readonly int RightParameter = Animator.StringToHash("Right")
 Animator parameter for sideward motion.
static readonly int RotateParameter = Animator.StringToHash("Rotation")
 Animator parameter for rotational motion.
static readonly int SpeedParameter = Animator.StringToHash("ForwardSpeed")
 Animation parameter for forward/backward speed.
static readonly int SideSpeedParameter = Animator.StringToHash("SidewardSpeed")
 Animation paramter for sideward speed.
static readonly int BaseLayer = 0
 The id of the animator base layer.
static readonly int SidestepLayer = 1
 The id of the sidestep layer of the animator.
static readonly int SidestepWalk = Animator.StringToHash("Sidestep.Strafe")
 The id of the SideStep.Walk animation state.

Properties

virtual float length [get]
 The length of the creature.

Member Function Documentation

◆ GetStdOrientation()

virtual Quaternion Creatures.Creature.GetStdOrientation ( )
virtual

Get the standard orientation of the model.

Returns
The standard orientation of the model

This matches the orientation of the target rig. This orienation does not depend on the orientations of the bones in the model but is derived from the hierarchy of the bones

Reimplemented in Creatures.Insects.Insect.

◆ GenerateBoneDictionary()

Dictionary< string, Transform > Creatures.Creature.GenerateBoneDictionary ( Transform root)
static

Get all protential bones in the model.

Parameters
root
Returns

◆ UpdatePose()

virtual void Creatures.Creature.UpdatePose ( )
virtual

Update the bones of the creature's rig from the target rig pose.

Reimplemented in Creatures.Insects.Insect.

◆ Animate()

virtual void Creatures.Creature.Animate ( )
virtual

Update the animator parameters based on the linear and angular velocity.

Reimplemented in Creatures.Insects.Insect.

◆ CalculateLinearVelocityWorld()

virtual Vector3 Creatures.Creature.CalculateLinearVelocityWorld ( float deltaTime)
protectedvirtual

Calculate the linear velocity in world space.

Parameters
deltaTimeThe time step to use
Returns
The linear velocity in meters/second

This should be called only once per update

Reimplemented in Creatures.Insects.Insect.

◆ CalculateAngularVelocityWorld()

virtual float Creatures.Creature.CalculateAngularVelocityWorld ( float deltaTime)
protectedvirtual

Calculate the angular velocity around the verical axis in world space.

Parameters
deltaTimeThe time step to use
Returns
The angular velocity in degrees per second

This should be called only once per update

Member Data Documentation

◆ rig

Rig Creatures.Creature.rig

The target bones rig.

The target bones rig contain the target pose of the creature The creature movements will try to move the creature such that the target pose is reached as closely as possible


The documentation for this class was generated from the following file: