TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
iCollideCharacter Struct Referenceabstract
Inheritance diagram for iCollideCharacter:
iUnknown

Detailed Description

Collide character interface.

A collide character wraps a CollideObject and provide methods to handle basic collision detection and dynamics. It allows to simply implement "game" like movement for characters and objects.

The collide object of the character is a cylinder scaled to the approriate height / radius.

Properties

virtual void SetClass (iHString *ahspClass)=0
 Set the class of the object. {Property}. More...
 
virtual iHStringGetClass () const =0
 Get the class of the object. {Property}. More...
 
virtual void SetFeetClass (iHString *ahspFeetClass)=0
 Set the feet class of the object. {Property}. More...
 
virtual iHStringGetFeetClass () const =0
 Get the feet class of the object. {Property}. More...
 
virtual void SetHeadClass (iHString *ahspHeadClass)=0
 Set the head class of the object. {Property}. More...
 
virtual iHStringGetHeadClass () const =0
 Get the head class of the object. {Property}. More...
 
virtual iCollideShapeGetShape () const =0
 Get the collide shape of the character. {Property}. More...
 
virtual iCollideObjectGetObject () const =0
 Get the collide object of the character. {Property}. More...
 
virtual void SetHeight (tF32 afHeight)=0
 Instantly set the height of the character. {Property}. More...
 
virtual tF32 GetHeight () const =0
 Instantly set the height of the character. {Property}. More...
 
virtual void SetRadius (tF32 afRadius)=0
 Set the collision radius of the character. {Property}. More...
 
virtual tF32 GetRadius () const =0
 Get the collision radius of the character. {Property}. More...
 
virtual void SetFeetRadius (tF32 afFeetRadius)=0
 Set the feet radius of the character. {Property}. More...
 
virtual tF32 GetFeetRadius () const =0
 Get the feet radius of the character. {Property}. More...
 
virtual void SetHeadRadius (tF32 afHeadRadius)=0
 Set the head radius of the character. {Property}. More...
 
virtual tF32 GetHeadRadius () const =0
 Get the head radius of the character. {Property}. More...
 
virtual void SetStairHeight (tF32 afHeight)=0
 Set the maximum height of slopes and steps a character can climb. {Property}. More...
 
virtual tF32 GetStairHeight () const =0
 Get the maximum height of slopes and steps a character can climb. {Property}. More...
 
virtual void SetAcceleration (eCollideCharacterMovement aMovement, tF32 afAcc)=0
 Set the acceleration of the character. {Property}. More...
 
virtual tF32 GetAcceleration (eCollideCharacterMovement aMovement) const =0
 Get the acceleration of the character. {Property}. More...
 
virtual void SetDeceleration (eCollideCharacterMovement aMovement, tF32 afAcc)=0
 Set the deceleration of the character. {Property}. More...
 
virtual tF32 GetDeceleration (eCollideCharacterMovement aMovement) const =0
 Get the deceleration of the character. {Property}. More...
 
virtual void SetVelocity (eCollideCharacterMovement aMovement, tF32 afAcc)=0
 Instantly set the velocity of the character. {Property}. More...
 
virtual tF32 GetVelocity (eCollideCharacterMovement aMovement) const =0
 Get the current velocity of the character. {Property}. More...
 
virtual void SetMaxVelocity (eCollideCharacterMovement aMovement, tF32 afAcc)=0
 Set the maximum acceleration of the character. {Property}. More...
 
virtual tF32 GetMaxVelocity (eCollideCharacterMovement aMovement) const =0
 Get the maximum acceleration of the character. {Property}. More...
 

Position

virtual void SetCenterPosition (const sVec3f &aPosition)=0
 Set the position of the center of the character. More...
 
virtual sVec3f GetCenterPosition () const =0
 Get the position of the center of the character. More...
 
virtual void SetFeetPosition (const sVec3f &aFeetPosition)=0
 Set the center position of the character from a "feet" position. More...
 
virtual sVec3f FeetToCenterPosition (const sVec3f &aFeetPos) const =0
 Converts a "feet" position to a "center" position. More...
 
virtual sVec3f GetFeetPosition () const =0
 Get the "feet" position of the character. More...
 
virtual sVec3f ToFeetPosition (const sVec3f &aPos) const =0
 Converts a "center" position to a "feet" position. More...
 
virtual void SetEyePosition (const sVec3f &aEyePosition, tF32 afEyeHeightFromFeet)=0
 Set the center position of the character from an "eye" position. More...
 
virtual sVec3f EyeToCenterPosition (const sVec3f &aEyePos, tF32 afEyeHeightFromFeet) const =0
 Converts a "eye" position to a "center" position. More...
 
virtual sVec3f GetEyePosition (tF32 afEyeHeightFromFeet) const =0
 Get the "eye" position of the character. More...
 
virtual sVec3f ToEyePosition (const sVec3f &aPos, tF32 afEyeHeightFromFeet) const =0
 Converts a "center" position to a "eye" position. More...
 

Queries

virtual tBool ChangeHeight (iCollideQuery *apQuery, tF32 afNewHeight)=0
 Changes the height of the character if the environment allows. More...
 
virtual tBool TestCollision (iCollideQuery *apQuery, const sVec3f &avPos)=0
 Checks if the character collides at the specified position where position is the center of the collider. More...
 
virtual void Accelerate (eCollideCharacterMovement aMovement, tF32 afValue)=0
 Accelerate the character in the specified direction. More...
 
virtual void Move (eCollideCharacterMovement aMovement, tF32 afValue)=0
 Moves the character in the specified direction. More...
 
virtual eCollideCharacterStatus ApplyMovement (tF32 aFrameTime, iCollideQuery *apQuery, const sVec3f &aFwd, const sVec3f &aRight)=0
 Apply movement and collision resolution to the character. More...
 
virtual eCollideCharacterStatus ApplyGravity (tF32 aFrameTime, iCollideQuery *apQuery)=0
 Apply gravity and stairs. More...
 
virtual eCollideCharacterStatus ApplyDeceleration (tF32 aFrameTime)=0
 Apply deceleration. More...
 

Additional Inherited Members

- Public Member Functions inherited from iUnknown
virtual tBool IsOK () const =0
 Check if the object is valid. More...
 
virtual tI32 AddRef ()=0
 Signal that one more reference of the object has been created. More...
 
virtual tI32 Release ()=0
 Release a reference of the object. More...
 
virtual void DeleteThis ()=0
 Bypass any reference counting and delete this object. More...
 
virtual void Invalidate ()=0
 Invalidate the object. More...
 
virtual iUnknownQueryInterface (const tUUID &aIID)=0
 Query an interface. More...
 
virtual void ListInterfaces (iMutableCollection *apLst, tU32 anFlags) const =0
 Fill a UUID list containing the UUIDs of the implemented interfaces. More...
 
virtual tI32 SetNumRefs (tI32 anNumRefs)=0
 Set the reference counter directly. More...
 
virtual tI32 GetNumRefs () const =0
 Get the number of references to this object. More...
 

Member Function Documentation

virtual void SetClass ( iHString ahspClass)
pure virtual

Set the class of the object. {Property}.

virtual iHString* GetClass ( ) const
pure virtual

Get the class of the object. {Property}.

virtual void SetFeetClass ( iHString ahspFeetClass)
pure virtual

Set the feet class of the object. {Property}.

virtual iHString* GetFeetClass ( ) const
pure virtual

Get the feet class of the object. {Property}.

virtual void SetHeadClass ( iHString ahspHeadClass)
pure virtual

Set the head class of the object. {Property}.

virtual iHString* GetHeadClass ( ) const
pure virtual

Get the head class of the object. {Property}.

virtual iCollideShape* GetShape ( ) const
pure virtual

Get the collide shape of the character. {Property}.

virtual iCollideObject* GetObject ( ) const
pure virtual

Get the collide object of the character. {Property}.

Remarks
The object is re-created when an update function is called with a query pointing in another scene.
virtual void SetHeight ( tF32  afHeight)
pure virtual

Instantly set the height of the character. {Property}.

virtual tF32 GetHeight ( ) const
pure virtual

Instantly set the height of the character. {Property}.

virtual void SetRadius ( tF32  afRadius)
pure virtual

Set the collision radius of the character. {Property}.

virtual tF32 GetRadius ( ) const
pure virtual

Get the collision radius of the character. {Property}.

virtual void SetFeetRadius ( tF32  afFeetRadius)
pure virtual

Set the feet radius of the character. {Property}.

Remarks
The head radius specifies the spread of the gravity raycast.
virtual tF32 GetFeetRadius ( ) const
pure virtual

Get the feet radius of the character. {Property}.

virtual void SetHeadRadius ( tF32  afHeadRadius)
pure virtual

Set the head radius of the character. {Property}.

Remarks
The head radius specifies the spread of the jumping raycast.
virtual tF32 GetHeadRadius ( ) const
pure virtual

Get the head radius of the character. {Property}.

virtual void SetStairHeight ( tF32  afHeight)
pure virtual

Set the maximum height of slopes and steps a character can climb. {Property}.

virtual tF32 GetStairHeight ( ) const
pure virtual

Get the maximum height of slopes and steps a character can climb. {Property}.

virtual void SetAcceleration ( eCollideCharacterMovement  aMovement,
tF32  afAcc 
)
pure virtual

Set the acceleration of the character. {Property}.

virtual tF32 GetAcceleration ( eCollideCharacterMovement  aMovement) const
pure virtual

Get the acceleration of the character. {Property}.

virtual void SetDeceleration ( eCollideCharacterMovement  aMovement,
tF32  afAcc 
)
pure virtual

Set the deceleration of the character. {Property}.

virtual tF32 GetDeceleration ( eCollideCharacterMovement  aMovement) const
pure virtual

Get the deceleration of the character. {Property}.

virtual void SetVelocity ( eCollideCharacterMovement  aMovement,
tF32  afAcc 
)
pure virtual

Instantly set the velocity of the character. {Property}.

virtual tF32 GetVelocity ( eCollideCharacterMovement  aMovement) const
pure virtual

Get the current velocity of the character. {Property}.

virtual void SetMaxVelocity ( eCollideCharacterMovement  aMovement,
tF32  afAcc 
)
pure virtual

Set the maximum acceleration of the character. {Property}.

virtual tF32 GetMaxVelocity ( eCollideCharacterMovement  aMovement) const
pure virtual

Get the maximum acceleration of the character. {Property}.

virtual void SetCenterPosition ( const sVec3f aPosition)
pure virtual

Set the position of the center of the character.

Parameters
aPositionis the position to set which is centered in the character. {Property}
virtual sVec3f GetCenterPosition ( ) const
pure virtual

Get the position of the center of the character.

Returns
the center of the character in world coordinates. {Property}
virtual void SetFeetPosition ( const sVec3f aFeetPosition)
pure virtual

Set the center position of the character from a "feet" position.

Parameters
aFeetPositionthe position to set {Property}
virtual sVec3f FeetToCenterPosition ( const sVec3f aFeetPos) const
pure virtual

Converts a "feet" position to a "center" position.

Parameters
aFeetPosthe center of the character
Returns
the "center" position for the specified character.
virtual sVec3f GetFeetPosition ( ) const
pure virtual

Get the "feet" position of the character.

Returns
the feet coordinates of the character in world coordinates. {Property}
virtual sVec3f ToFeetPosition ( const sVec3f aPos) const
pure virtual

Converts a "center" position to a "feet" position.

Parameters
aPosthe center of the character
Returns
the feet position for the specified character.
virtual void SetEyePosition ( const sVec3f aEyePosition,
tF32  afEyeHeightFromFeet 
)
pure virtual

Set the center position of the character from an "eye" position.

Parameters
aEyePositionthe position to set
afEyeHeightFromFeetis the eye height from the feet of the character.
virtual sVec3f EyeToCenterPosition ( const sVec3f aEyePos,
tF32  afEyeHeightFromFeet 
) const
pure virtual

Converts a "eye" position to a "center" position.

Parameters
aEyePosthe center of the character
afEyeHeightFromFeet
Returns
the "center" position for the specified character.
virtual sVec3f GetEyePosition ( tF32  afEyeHeightFromFeet) const
pure virtual

Get the "eye" position of the character.

Parameters
afEyeHeightFromFeetis the eye height from the feet of the character.
Returns
the eye coordinates of the character in world coordinates.
virtual sVec3f ToEyePosition ( const sVec3f aPos,
tF32  afEyeHeightFromFeet 
) const
pure virtual

Converts a "center" position to a "eye" position.

Parameters
aPosthe center of the character
afEyeHeightFromFeet
Returns
the "eye" position for the specified character.
virtual tBool ChangeHeight ( iCollideQuery apQuery,
tF32  afNewHeight 
)
pure virtual

Changes the height of the character if the environment allows.

Returns
true if changed else false.
virtual tBool TestCollision ( iCollideQuery apQuery,
const sVec3f avPos 
)
pure virtual

Checks if the character collides at the specified position where position is the center of the collider.

virtual void Accelerate ( eCollideCharacterMovement  aMovement,
tF32  afValue 
)
pure virtual

Accelerate the character in the specified direction.

-- ex: Moving forward --
void onForward(tF32 afV) {
    mpCharacter->Accelerate(
         eCollideCharacterMovement_Forward,
         afV * ni::GetLang()->GetFrameTime());
}
Parameters
aMovementis the direction along which the character will accelerate.
afValuethe movement "force", will be multiplied by the acceleration of the character, should be frame time dependent.
virtual void Move ( eCollideCharacterMovement  aMovement,
tF32  afValue 
)
pure virtual

Moves the character in the specified direction.

-- ex: Moving forward --
void onForward(tF32 afV) {
    mpCharacter->Move(
         eCollideCharacterMovement_Forward,
         afV * ni::GetLang()->GetFrameTime());
}
Parameters
aMovementis the direction along which the character will move.
afValueshould be frame time dependent.
virtual eCollideCharacterStatus ApplyMovement ( tF32  aFrameTime,
iCollideQuery apQuery,
const sVec3f aFwd,
const sVec3f aRight 
)
pure virtual

Apply movement and collision resolution to the character.

Parameters
aFrameTimeis the frame time
apQuery
aFwdis the direction in which the character moves forward.
aRightis the direction in which the character moves side-ward.
virtual eCollideCharacterStatus ApplyGravity ( tF32  aFrameTime,
iCollideQuery apQuery 
)
pure virtual

Apply gravity and stairs.

Parameters
aFrameTimeis the frame time
apQuery
Remarks
Gravity is always allong the world's Y axis.
virtual eCollideCharacterStatus ApplyDeceleration ( tF32  aFrameTime)
pure virtual

Apply deceleration.