Drag[en]gine Game Engine  1.0
deTouchSensor Class Reference

Touch Sensor Resource. More...

#include <deTouchSensor.h>

Inheritance diagram for deTouchSensor:
deResource deObject

Public Member Functions

Management
const decDVectorGetPosition () const
 
void SetPosition (const decDVector &position)
 
const decQuaternionGetOrientation () const
 
void SetOrientation (const decQuaternion &orientation)
 
decCollisionFilterGetCollisionFilter ()
 Retrieves the collision filter. More...
 
const decCollisionFilterGetCollisionFilter () const
 
void NotifyCollisionFilterChanged ()
 Notifies the peers that the collision filter changed. More...
 
bool GetTrackEnterLeave () const
 Determines if the touch sensor tracks objects entering and leaving shapes. More...
 
void SetTrackEnterLeave (bool trackEnterLeave)
 Sets if the touch sensor tracks objects entering and leaving shapes. More...
 
bool GetEnabled () const
 Determines if the touch sensor is enabled. More...
 
void SetEnabled (bool enabled)
 Sets if the touch sensor is enabled. More...
 
bool IsShapeEmpty (int shape) const
 
int GetShapeColliderCount (int shape) const
 
deColliderGetShapeColliderAt (int shape, int collider) const
 
void NotifyColliderEnteredShape (int shape, deCollider *collider)
 
void NotifyColliderLeftShape (int shape, deCollider *collider)
 
Ignore colliders
int GetIgnoreColliderCount () const
 Number of colliders to ignore. More...
 
deColliderGetIgnoreColliderAt (int index) const
 Collider to ignore at index. More...
 
bool HasIgnoreCollider (deCollider *collider) const
 Collider to ignore is present. More...
 
void AddIgnoreCollider (deCollider *collider)
 Add collider to ignore. More...
 
void RemoveIgnoreCollider (deCollider *collider)
 Remove collider to ignore. More...
 
void RemoveAllIgnoreColliders ()
 Remove all colliders to ignore. More...
 
Collision Detection
void RayHits (int shape, const decDVector &rayOrigin, const decVector &rayDirection, deBaseScriptingCollider *listener)
 
void ColliderHits (int shape, deCollider *collider, deBaseScriptingCollider *listener)
 
void ColliderMoveHits (int shape, deCollider *collider, const decVector &displacement, deBaseScriptingCollider *listener)
 
void ColliderRotateHits (int shape, deCollider *collider, const decVector &rotation, deBaseScriptingCollider *listener)
 
void ColliderMoveRotateHits (int shape, deCollider *collider, const decVector &displacement, const decVector &rotation, deBaseScriptingCollider *listener)
 
Shapes
int GetShapeCount () const
 
decShapeGetShapeAt (int index) const
 
int IndexOfShape (decShape *shape) const
 
bool HasShape (decShape *shape) const
 
void SetShapeAt (int index, decShape *shape)
 
void AddShape (decShape *shape)
 
void RemoveShape (decShape *shape)
 
void RemoveShapeFrom (int index)
 
void RemoveAllShapes ()
 
System Peers
deBasePhysicsTouchSensorGetPhysicsTouchSensor () const
 
void SetPhysicsTouchSensor (deBasePhysicsTouchSensor *phyTS)
 
deBaseScriptingTouchSensorGetScriptingTouchSensor () const
 
void SetScriptingTouchSensor (deBaseScriptingTouchSensor *scrTS)
 
Linked List
deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deTouchSensorGetLLWorldPrev () const
 Previous touch sensor in the parent world linked list. More...
 
void SetLLWorldPrev (deTouchSensor *touchSensor)
 Set next touch sensor in the parent world linked list. More...
 
deTouchSensorGetLLWorldNext () const
 Next touch sensor in the parent world linked list. More...
 
void SetLLWorldNext (deTouchSensor *touchSensor)
 Set next touch sensor in the parent world linked list. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deTouchSensor (deTouchSensorManager *manager)
 
virtual ~deTouchSensor ()
 Clean up lumimeter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

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.

Author
Pl├╝ss Roland
Version
1.0
Date
2008

Constructor & Destructor Documentation

◆ deTouchSensor()

deTouchSensor::deTouchSensor ( deTouchSensorManager manager)

Creates a new lumimeter.

◆ ~deTouchSensor()

virtual deTouchSensor::~deTouchSensor ( )
protectedvirtual

Clean up lumimeter.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddIgnoreCollider()

void deTouchSensor::AddIgnoreCollider ( deCollider collider)

Add collider to ignore.

Exceptions
deeInvalidParamcollider is present.

Referenced by GetEnabled().

◆ AddShape()

void deTouchSensor::AddShape ( decShape shape)

Adds a shape.

Referenced by GetEnabled().

◆ ColliderHits()

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.

Referenced by GetEnabled().

◆ ColliderMoveHits()

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.

Referenced by GetEnabled().

◆ ColliderMoveRotateHits()

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.

Referenced by GetEnabled().

◆ ColliderRotateHits()

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.

Referenced by GetEnabled().

◆ GetCollisionFilter() [1/2]

decCollisionFilter& deTouchSensor::GetCollisionFilter ( )
inline

Retrieves the collision filter.

Call NotifyCollisionFilterChanged if you change the collision filter.

◆ GetCollisionFilter() [2/2]

const decCollisionFilter& deTouchSensor::GetCollisionFilter ( ) const
inline

◆ GetEnabled()

◆ GetIgnoreColliderAt()

deCollider* deTouchSensor::GetIgnoreColliderAt ( int  index) const

Collider to ignore at index.

Exceptions
deeInvalidParamindex is less than 0.
deeInvalidParamindex is greater or equal than GetIgnoreColliderCount()-1.

Referenced by GetEnabled().

◆ GetIgnoreColliderCount()

int deTouchSensor::GetIgnoreColliderCount ( ) const

Number of colliders to ignore.

Referenced by GetEnabled().

◆ GetLLWorldNext()

deTouchSensor* deTouchSensor::GetLLWorldNext ( ) const
inline

Next touch sensor in the parent world linked list.

References SetLLWorldNext().

◆ GetLLWorldPrev()

deTouchSensor* deTouchSensor::GetLLWorldPrev ( ) const
inline

Previous touch sensor in the parent world linked list.

References SetLLWorldPrev().

◆ GetOrientation()

const decQuaternion& deTouchSensor::GetOrientation ( ) const
inline

Retrieves the orientation.

References SetOrientation().

◆ GetParentWorld()

deWorld* deTouchSensor::GetParentWorld ( ) const
inline

Parent world or NULL.

References SetParentWorld().

◆ GetPhysicsTouchSensor()

deBasePhysicsTouchSensor* deTouchSensor::GetPhysicsTouchSensor ( ) const
inline

Retrieves the physics system peer.

References SetPhysicsTouchSensor().

◆ GetPosition()

const decDVector& deTouchSensor::GetPosition ( ) const
inline

Retrieves the position.

References SetPosition().

◆ GetScriptingTouchSensor()

deBaseScriptingTouchSensor* deTouchSensor::GetScriptingTouchSensor ( ) const
inline

Retrieves the scripting system peer.

References SetScriptingTouchSensor().

◆ GetShapeAt()

decShape* deTouchSensor::GetShapeAt ( int  index) const

Retrieves the shape at the given index.

Referenced by GetEnabled().

◆ GetShapeColliderAt()

deCollider* deTouchSensor::GetShapeColliderAt ( int  shape,
int  collider 
) const

Retrieves the collider at the given index in the given shape.

Parameters
shapeIndex of the shape to query.
colliderIndex of the collider retrieve from the shape.
Returns
collider at the given index in the given shape.

Referenced by GetEnabled().

◆ GetShapeColliderCount()

int deTouchSensor::GetShapeColliderCount ( int  shape) const

Retrieves the number of colliders in the given shape.

Parameters
shapeIndex of the shape to query.
Returns
number of colliders in the shape.

Referenced by GetEnabled().

◆ GetShapeCount()

int deTouchSensor::GetShapeCount ( ) const

Retrieves the number of shapes.

Referenced by GetEnabled().

◆ GetTrackEnterLeave()

bool deTouchSensor::GetTrackEnterLeave ( ) const
inline

Determines if the touch sensor tracks objects entering and leaving shapes.

References SetTrackEnterLeave().

◆ HasIgnoreCollider()

bool deTouchSensor::HasIgnoreCollider ( deCollider collider) const

Collider to ignore is present.

Referenced by GetEnabled().

◆ HasShape()

bool deTouchSensor::HasShape ( decShape shape) const

Determines if the shape exists.

Referenced by GetEnabled().

◆ IndexOfShape()

int deTouchSensor::IndexOfShape ( decShape shape) const

Retrieves the index of the given shape or -1 if not found.

Referenced by GetEnabled().

◆ IsShapeEmpty()

bool deTouchSensor::IsShapeEmpty ( int  shape) const

Determines if the given shape contains no colliders.

Parameters
shapeIndex of the shape to test.

Referenced by GetEnabled().

◆ NotifyColliderEnteredShape()

void deTouchSensor::NotifyColliderEnteredShape ( int  shape,
deCollider collider 
)

Notifies the scripting module peer that a collider entered a sensor shape.

Parameters
shapeIndex of the shape the collider entered.
colliderCollider entering the shape.

Referenced by GetEnabled().

◆ NotifyColliderLeftShape()

void deTouchSensor::NotifyColliderLeftShape ( int  shape,
deCollider collider 
)

Notifies the scripting module peer that a collider left a sensor shape.

Parameters
shapeIndex of the shape the collider left.
colliderCollider entering the shape.

Referenced by GetEnabled().

◆ NotifyCollisionFilterChanged()

void deTouchSensor::NotifyCollisionFilterChanged ( )

Notifies the peers that the collision filter changed.

Referenced by GetCollisionFilter().

◆ RayHits()

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.

Referenced by GetEnabled().

◆ RemoveAllIgnoreColliders()

void deTouchSensor::RemoveAllIgnoreColliders ( )

Remove all colliders to ignore.

Referenced by GetEnabled().

◆ RemoveAllShapes()

void deTouchSensor::RemoveAllShapes ( )

Removes all shapes.

Referenced by GetEnabled().

◆ RemoveIgnoreCollider()

void deTouchSensor::RemoveIgnoreCollider ( deCollider collider)

Remove collider to ignore.

Exceptions
deeInvalidParamcollider is absent.

Referenced by GetEnabled().

◆ RemoveShape()

void deTouchSensor::RemoveShape ( decShape shape)

Removes a shape.

Referenced by GetEnabled().

◆ RemoveShapeFrom()

void deTouchSensor::RemoveShapeFrom ( int  index)

Removes a shape from the given index.

Referenced by GetEnabled().

◆ SetEnabled()

void deTouchSensor::SetEnabled ( bool  enabled)

Sets if the touch sensor is enabled.

Referenced by GetEnabled().

◆ SetLLWorldNext()

void deTouchSensor::SetLLWorldNext ( deTouchSensor touchSensor)

Set next touch sensor in the parent world linked list.

Referenced by GetLLWorldNext().

◆ SetLLWorldPrev()

void deTouchSensor::SetLLWorldPrev ( deTouchSensor touchSensor)

Set next touch sensor in the parent world linked list.

Referenced by GetLLWorldPrev().

◆ SetOrientation()

void deTouchSensor::SetOrientation ( const decQuaternion orientation)

Sets the orientation.

Referenced by GetOrientation().

◆ SetParentWorld()

void deTouchSensor::SetParentWorld ( deWorld world)

Set parent world or NULL.

Referenced by GetParentWorld().

◆ SetPhysicsTouchSensor()

void deTouchSensor::SetPhysicsTouchSensor ( deBasePhysicsTouchSensor phyTS)

Sets the physics system peer.

Referenced by GetPhysicsTouchSensor().

◆ SetPosition()

void deTouchSensor::SetPosition ( const decDVector position)

Sets the position.

Referenced by GetPosition().

◆ SetScriptingTouchSensor()

void deTouchSensor::SetScriptingTouchSensor ( deBaseScriptingTouchSensor scrTS)

Sets the scripting system peer.

Referenced by GetScriptingTouchSensor().

◆ SetShapeAt()

void deTouchSensor::SetShapeAt ( int  index,
decShape shape 
)

Sets the shape at the given index.

Referenced by GetEnabled().

◆ SetTrackEnterLeave()

void deTouchSensor::SetTrackEnterLeave ( bool  trackEnterLeave)

Sets if the touch sensor tracks objects entering and leaving shapes.

Referenced by GetTrackEnterLeave().


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