This class receives callbacks when a virtual character hits something.
More...
#include <CharacterVirtual.h>
|
virtual | ~CharacterContactListener ()=default |
| Destructor. More...
|
|
virtual void | OnAdjustBodyVelocity (const CharacterVirtual *inCharacter, const Body &inBody2, Vec3 &ioLinearVelocity, Vec3 &ioAngularVelocity) |
|
virtual bool | OnContactValidate (const CharacterVirtual *inCharacter, const BodyID &inBodyID2, const SubShapeID &inSubShapeID2) |
| Checks if a character can collide with specified body. Return true if the contact is valid. More...
|
|
virtual void | OnContactAdded (const CharacterVirtual *inCharacter, const BodyID &inBodyID2, const SubShapeID &inSubShapeID2, RVec3Arg inContactPosition, Vec3Arg inContactNormal, CharacterContactSettings &ioSettings) |
|
virtual void | OnContactSolve (const CharacterVirtual *inCharacter, const BodyID &inBodyID2, const SubShapeID &inSubShapeID2, RVec3Arg inContactPosition, Vec3Arg inContactNormal, Vec3Arg inContactVelocity, const PhysicsMaterial *inContactMaterial, Vec3Arg inCharacterVelocity, Vec3 &ioNewCharacterVelocity) |
|
This class receives callbacks when a virtual character hits something.
◆ ~CharacterContactListener()
virtual CharacterContactListener::~CharacterContactListener |
( |
| ) |
|
|
virtualdefault |
◆ OnAdjustBodyVelocity()
virtual void CharacterContactListener::OnAdjustBodyVelocity |
( |
const CharacterVirtual * |
inCharacter, |
|
|
const Body & |
inBody2, |
|
|
Vec3 & |
ioLinearVelocity, |
|
|
Vec3 & |
ioAngularVelocity |
|
) |
| |
|
inlinevirtual |
Callback to adjust the velocity of a body as seen by the character. Can be adjusted to e.g. implement a conveyor belt or an inertial dampener system of a sci-fi space ship. Note that inBody2 is locked during the callback so you can read its properties freely.
◆ OnContactAdded()
Called whenever the character collides with a body.
- Parameters
-
inCharacter | Character that is being solved |
inBodyID2 | Body ID of body that is being hit |
inSubShapeID2 | Sub shape ID of shape that is being hit |
inContactPosition | World space contact position |
inContactNormal | World space contact normal |
ioSettings | Settings returned by the contact callback to indicate how the character should behave |
◆ OnContactSolve()
Called whenever a contact is being used by the solver. Allows the listener to override the resulting character velocity (e.g. by preventing sliding along certain surfaces).
- Parameters
-
inCharacter | Character that is being solved |
inBodyID2 | Body ID of body that is being hit |
inSubShapeID2 | Sub shape ID of shape that is being hit |
inContactPosition | World space contact position |
inContactNormal | World space contact normal |
inContactVelocity | World space velocity of contact point (e.g. for a moving platform) |
inContactMaterial | Material of contact point |
inCharacterVelocity | World space velocity of the character prior to hitting this contact |
ioNewCharacterVelocity | Contains the calculated world space velocity of the character after hitting this contact, this velocity slides along the surface of the contact. Can be modified by the listener to provide an alternative velocity. |
◆ OnContactValidate()
Checks if a character can collide with specified body. Return true if the contact is valid.
The documentation for this class was generated from the following file: