Touch Sensor Resource. More...
#include <deTouchSensor.h>
Public Member Functions | |
Constructors and Destructors | |
| deTouchSensor (deTouchSensorManager *manager) | |
| Creates a new lumimeter. | |
| virtual | ~deTouchSensor () |
| Cleans up the lumimeter. | |
Management | |
| const decDVector & | GetPosition () const |
| Retrieves the position. | |
| void | SetPosition (const decDVector &position) |
| Sets the position. | |
| const decQuaternion & | GetOrientation () const |
| Retrieves the orientation. | |
| void | SetOrientation (const decQuaternion &orientation) |
| Sets the orientation. | |
| deWorld * | GetParentWorld () const |
| Retrieves the parent world or NULL if not added to a world yet. | |
| void | SetParentWorld (deWorld *world) |
| Sets the parent world or NULL if not added to a world. | |
| void | NotifyColliderEnteredShape (int shape, deCollider *collider) |
| Notifies the scripting module peer that a collider entered a sensor shape. | |
| void | NotifyColliderLeftShape (int shape, deCollider *collider) |
| Notifies the scripting module peer that a collider left a sensor shape. | |
| decLayerMask & | GetLayerMask () |
| Retrieves the layer mask. | |
| void | NotifyLayerMaskChanged () |
| Notifies the peers that the layer mask changed. | |
| int | GetGroupNumber () const |
| Retrieves the group number or 0 if not set. | |
| void | SetGroupNumber (int groupNumber) |
| Sets the group number or 0 if not set. | |
| bool | CanHit (const decLayerMask &layerMask, int groupNumber) const |
| Determines if this collider can hit another object represented by a layer mask and a group number. | |
| bool | IsShapeEmpty (int shape) const |
| Determines if the given shape contains no colliders. | |
| int | GetShapeColliderCount (int shape) const |
| Retrieves the number of colliders in the given shape. | |
| deCollider * | GetShapeColliderAt (int shape, int collider) const |
| Retrieves the collider at the given index in the given shape. | |
Collision Detection | |
| void | RayHits (int shape, const decDVector &rayOrigin, const decVector &rayDirection, deBaseScriptingCollider *listener) |
| Tests a ray for collision with the element in the given shape.For each collision the collisionResponse function the given listener is called. | |
| void | ColliderHits (int shape, deCollider *collider, deBaseScriptingCollider *listener) |
| Tests the collider for collision with scene elements. | |
| void | ColliderMoveHits (int shape, deCollider *collider, const decVector &displacement, deBaseScriptingCollider *listener) |
| Tests the moving collider for collision with scene elements. | |
| void | ColliderRotateHits (int shape, deCollider *collider, const decVector &rotation, deBaseScriptingCollider *listener) |
| Tests the rotating collider for collision with scene elements. | |
| void | ColliderMoveRotateHits (int shape, deCollider *collider, const decVector &displacement, const decVector &rotation, deBaseScriptingCollider *listener) |
| Tests the moving and rotating collider for collision with scene elements. | |
Shapes | |
| int | GetShapeCount () const |
| Retrieves the number of shapes. | |
| decShape * | GetShapeAt (int index) const |
| Retrieves the shape at the given index. | |
| int | IndexOfShape (decShape *shape) const |
| Retrieves the index of the given shape or -1 if not found. | |
| bool | HasShape (decShape *shape) const |
| Determines if the shape exists. | |
| void | SetShapeAt (int index, decShape *shape) |
| Sets the shape at the given index. | |
| void | AddShape (decShape *shape) |
| Adds a shape. | |
| void | RemoveShape (decShape *shape) |
| Removes a shape. | |
| void | RemoveShapeFrom (int index) |
| Removes a shape from the given index. | |
| void | RemoveAllShapes () |
| Removes all shapes. | |
System Peers | |
| deBasePhysicsTouchSensor * | GetPhysicsTouchSensor () const |
| Retrieves the physics system peer. | |
| void | SetPhysicsTouchSensor (deBasePhysicsTouchSensor *phyTS) |
| Sets the physics system peer. | |
| deBaseScriptingTouchSensor * | GetScriptingTouchSensor () const |
| Retrieves the scripting system peer. | |
| void | SetScriptingTouchSensor (deBaseScriptingTouchSensor *scrTS) |
| Sets the scripting system peer. | |
Touch Sensor Resource.
Touch sensors detect the presence of colliders in a set of collision shapes. The touch sensor groups in fact multiple sensors in one object. This grouping improves performance since the shapes share a close spatial relationship which reduces greatly the number of collision tests required. Whenever a collider enters or leaves one of the shapes a notification is send to the scripting module peer. The touch sensor itself does not store the colliders and faces in contact with any of the shapes. This is the responsability of the scripting module peer. The reason for this design choice is that game scripts usually require only a subset of the encountered colliders for further processing. In addition actual game actions tend to be linked to colliders entering or leaving a given location in space. Iterating a list each frame update would be too time consuming in large worlds. Like colliders touch sensors too use a layer mask and group number to determine what colliders can be tracked.
| deTouchSensor::deTouchSensor | ( | deTouchSensorManager * | manager ) |
Creates a new lumimeter.
| virtual deTouchSensor::~deTouchSensor | ( | ) | [virtual] |
Cleans up the lumimeter.
| void deTouchSensor::AddShape | ( | decShape * | shape ) |
Adds a shape.
| bool deTouchSensor::CanHit | ( | const decLayerMask & | layerMask, |
| int | groupNumber | ||
| ) | const |
Determines if this collider can hit another object represented by a layer mask and a group number.
The layer mask and the group number of both entities are checked for a match. Group numbers match only if neither of them is 0.
| layerMask | Layer mask to test against. |
| groupNumber | Group number to test against. |
| void deTouchSensor::ColliderHits | ( | int | shape, |
| deCollider * | collider, | ||
| deBaseScriptingCollider * | listener | ||
| ) |
Tests the collider for collision with scene elements.
For each collision the collisionResponse function of the listener assigned to the collider is called. To stop testing set StopTesting in the provided collision information object to true.
Has to be overwritten by the physics system to provide this test. The default implementation does nothing at all.
| void deTouchSensor::ColliderMoveHits | ( | int | shape, |
| deCollider * | collider, | ||
| const decVector & | displacement, | ||
| deBaseScriptingCollider * | listener | ||
| ) |
Tests the moving collider for collision with scene elements.
For each collision starting with the earliest the collisionResponse function of the listener assigned to the collider is called. To stop testing set StopTesting in the provided collision information object to true.
Has to be overwritten by the physics system to provide this test. The default implementation does nothing at all.
| void deTouchSensor::ColliderMoveRotateHits | ( | int | shape, |
| deCollider * | collider, | ||
| const decVector & | displacement, | ||
| const decVector & | rotation, | ||
| deBaseScriptingCollider * | listener | ||
| ) |
Tests the moving and rotating collider for collision with scene elements.
For each collision starting with the earliest the collisionResponse function of the listener assigned to the collider is called. To stop testing set StopTesting in the provided collision information object to true.
Has to be overwritten by the physics system to provide this test. The default implementation does nothing at all.
| void deTouchSensor::ColliderRotateHits | ( | int | shape, |
| deCollider * | collider, | ||
| const decVector & | rotation, | ||
| deBaseScriptingCollider * | listener | ||
| ) |
Tests the rotating collider for collision with scene elements.
For each collision starting with the earliest the collisionResponse function of the listener assigned to the collider is called. To stop testing set StopTesting in the provided collision information object to true.
Has to be overwritten by the physics system to provide this test. The default implementation does nothing at all.
| int deTouchSensor::GetGroupNumber | ( | ) | const [inline] |
Retrieves the group number or 0 if not set.
| decLayerMask& deTouchSensor::GetLayerMask | ( | ) | [inline] |
Retrieves the layer mask.
Call NotifyLayerMaskChanged afte you have changed this object.
| const decQuaternion& deTouchSensor::GetOrientation | ( | ) | const [inline] |
Retrieves the orientation.
| deWorld* deTouchSensor::GetParentWorld | ( | ) | const [inline] |
Retrieves the parent world or NULL if not added to a world yet.
| deBasePhysicsTouchSensor* deTouchSensor::GetPhysicsTouchSensor | ( | ) | const [inline] |
Retrieves the physics system peer.
| const decDVector& deTouchSensor::GetPosition | ( | ) | const [inline] |
Retrieves the position.
| deBaseScriptingTouchSensor* deTouchSensor::GetScriptingTouchSensor | ( | ) | const [inline] |
Retrieves the scripting system peer.
| decShape* deTouchSensor::GetShapeAt | ( | int | index ) | const |
Retrieves the shape at the given index.
| deCollider* deTouchSensor::GetShapeColliderAt | ( | int | shape, |
| int | collider | ||
| ) | const |
Retrieves the collider at the given index in the given shape.
| shape | Index of the shape to query. |
| collider | Index of the collider retrieve from the shape. |
| int deTouchSensor::GetShapeColliderCount | ( | int | shape ) | const |
Retrieves the number of colliders in the given shape.
| shape | Index of the shape to query. |
| int deTouchSensor::GetShapeCount | ( | ) | const |
Retrieves the number of shapes.
| bool deTouchSensor::HasShape | ( | decShape * | shape ) | const |
Determines if the shape exists.
| int deTouchSensor::IndexOfShape | ( | decShape * | shape ) | const |
Retrieves the index of the given shape or -1 if not found.
| bool deTouchSensor::IsShapeEmpty | ( | int | shape ) | const |
Determines if the given shape contains no colliders.
| shape | Index of the shape to test. |
| void deTouchSensor::NotifyColliderEnteredShape | ( | int | shape, |
| deCollider * | collider | ||
| ) |
Notifies the scripting module peer that a collider entered a sensor shape.
| shape | Index of the shape the collider entered. |
| collider | Collider entering the shape. |
| void deTouchSensor::NotifyColliderLeftShape | ( | int | shape, |
| deCollider * | collider | ||
| ) |
Notifies the scripting module peer that a collider left a sensor shape.
| shape | Index of the shape the collider left. |
| collider | Collider entering the shape. |
| void deTouchSensor::NotifyLayerMaskChanged | ( | ) |
Notifies the peers that the layer mask changed.
| void deTouchSensor::RayHits | ( | int | shape, |
| const decDVector & | rayOrigin, | ||
| const decVector & | rayDirection, | ||
| deBaseScriptingCollider * | listener | ||
| ) |
Tests a ray for collision with the element in the given shape.For each collision the collisionResponse function the given listener is called.
To stop testing set StopTesting in the provided collision information object to true. The distance parameter in the collision response represents the actual distance to the ray origin along the ray direction.
| void deTouchSensor::RemoveAllShapes | ( | ) |
Removes all shapes.
| void deTouchSensor::RemoveShape | ( | decShape * | shape ) |
Removes a shape.
| void deTouchSensor::RemoveShapeFrom | ( | int | index ) |
Removes a shape from the given index.
| void deTouchSensor::SetGroupNumber | ( | int | groupNumber ) |
Sets the group number or 0 if not set.
| groupNumber | Group number or 0. |
| void deTouchSensor::SetOrientation | ( | const decQuaternion & | orientation ) |
Sets the orientation.
| void deTouchSensor::SetParentWorld | ( | deWorld * | world ) |
Sets the parent world or NULL if not added to a world.
| void deTouchSensor::SetPhysicsTouchSensor | ( | deBasePhysicsTouchSensor * | phyTS ) |
Sets the physics system peer.
| void deTouchSensor::SetPosition | ( | const decDVector & | position ) |
Sets the position.
| void deTouchSensor::SetScriptingTouchSensor | ( | deBaseScriptingTouchSensor * | scrTS ) |
Sets the scripting system peer.
| void deTouchSensor::SetShapeAt | ( | int | index, |
| decShape * | shape | ||
| ) |
Sets the shape at the given index.
1.7.2