Drag[en]gine Game Engine  1.21
deTouchSensor Class Reference

Touch Sensor Resource. More...

#include <deTouchSensor.h>

Inheritance diagram for deTouchSensor:
deResource deObject

Public Types

typedef deTObjectReference< deTouchSensorRef
 Type holding strong reference. More...
 
- Public Types inherited from deResource
typedef deTObjectReference< deResourceRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
const decDVectorGetPosition () const
 Position. More...
 
void SetPosition (const decDVector &position)
 Set position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
const decCollisionFilterGetCollisionFilter () const
 Collision filter. More...
 
void SetCollisionFilter (const decCollisionFilter &collisionFilter)
 Set collision filter. More...
 
bool GetTrackEnterLeave () const
 Touch sensor tracks objects entering and leaving shapes. More...
 
void SetTrackEnterLeave (bool trackEnterLeave)
 Set if touch sensor tracks objects entering and leaving shapes. More...
 
bool GetEnabled () const
 Touch sensor is enabled. More...
 
void SetEnabled (bool enabled)
 Set if touch sensor is enabled. More...
 
const decShapeListGetShape () const
 Shape. More...
 
void SetShape (const decShapeList &shape)
 Set shape. More...
 
bool IsEmpty () const
 Touch sensor contains colliders. More...
 
int GetColliderCount () const
 Number of colliders in touch sensor. More...
 
deColliderGetColliderAt (int collider) const
 Collider at index in touch sensor. More...
 
void NotifyColliderEntered (deCollider *collider)
 Notify scripting module peer collider entered touch sensor. More...
 
void NotifyColliderLeft (deCollider *collider)
 Notify scripting module peer collider left touch sensor. More...
 
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
bool PointInside (const decDVector &point)
 Test if a point is located inside the touch sensor. More...
 
void AllHits (deBaseScriptingCollider *listener)
 Visit all touching elements with listener. More...
 
void RayHits (const decDVector &rayOrigin, const decVector &rayDirection, deBaseScriptingCollider *listener)
 Test ray for collision with the element in the given shape. More...
 
void ColliderHits (deCollider *collider, deBaseScriptingCollider *listener)
 Test collider for collision with scene elements. More...
 
void ColliderMoveHits (deCollider *collider, const decVector &displacement, deBaseScriptingCollider *listener)
 Test moving collider for collision with scene elements. More...
 
void ColliderRotateHits (deCollider *collider, const decVector &rotation, deBaseScriptingCollider *listener)
 Test rotating collider for collision with scene elements. More...
 
void ColliderMoveRotateHits (deCollider *collider, const decVector &displacement, const decVector &rotation, deBaseScriptingCollider *listener)
 Test moving and rotating collider for collision with scene elements. More...
 
System Peers
deBasePhysicsTouchSensorGetPeerPhysics () const
 Physics system peer. More...
 
void SetPeerPhysics (deBasePhysicsTouchSensor *peer)
 Set physics system peer. More...
 
deBaseScriptingTouchSensorGetPeerScripting () const
 Scripting system peer. More...
 
void SetPeerScripting (deBaseScriptingTouchSensor *peer)
 Set scripting system peer. More...
 
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)
 Create touch sensor. More...
 
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.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ deTouchSensor()

deTouchSensor::deTouchSensor ( deTouchSensorManager manager)

Create touch sensor.

◆ ~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.

◆ AllHits()

void deTouchSensor::AllHits ( deBaseScriptingCollider listener)

Visit all touching elements with listener.

To stop testing set StopTesting in the provided collision information object to true.

◆ ColliderHits()

void deTouchSensor::ColliderHits ( deCollider collider,
deBaseScriptingCollider listener 
)

Test 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.

◆ ColliderMoveHits()

void deTouchSensor::ColliderMoveHits ( deCollider collider,
const decVector displacement,
deBaseScriptingCollider listener 
)

Test 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.

◆ ColliderMoveRotateHits()

void deTouchSensor::ColliderMoveRotateHits ( deCollider collider,
const decVector displacement,
const decVector rotation,
deBaseScriptingCollider listener 
)

Test 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.

◆ ColliderRotateHits()

void deTouchSensor::ColliderRotateHits ( deCollider collider,
const decVector rotation,
deBaseScriptingCollider listener 
)

Test 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.

◆ GetColliderAt()

deCollider* deTouchSensor::GetColliderAt ( int  collider) const

Collider at index in touch sensor.

Parameters
colliderIndex of the collider retrieve from the shape.

◆ GetColliderCount()

int deTouchSensor::GetColliderCount ( ) const

Number of colliders in touch sensor.

◆ GetCollisionFilter()

const decCollisionFilter& deTouchSensor::GetCollisionFilter ( ) const
inline

Collision filter.

◆ GetEnabled()

bool deTouchSensor::GetEnabled ( ) const
inline

Touch sensor is enabled.

◆ 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.

◆ GetIgnoreColliderCount()

int deTouchSensor::GetIgnoreColliderCount ( ) const

Number of colliders to ignore.

◆ GetLLWorldNext()

deTouchSensor* deTouchSensor::GetLLWorldNext ( ) const
inline

Next touch sensor in the parent world linked list.

◆ GetLLWorldPrev()

deTouchSensor* deTouchSensor::GetLLWorldPrev ( ) const
inline

Previous touch sensor in the parent world linked list.

◆ GetOrientation()

const decQuaternion& deTouchSensor::GetOrientation ( ) const
inline

Orientation.

◆ GetParentWorld()

deWorld* deTouchSensor::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerPhysics()

deBasePhysicsTouchSensor* deTouchSensor::GetPeerPhysics ( ) const
inline

Physics system peer.

◆ GetPeerScripting()

deBaseScriptingTouchSensor* deTouchSensor::GetPeerScripting ( ) const
inline

Scripting system peer.

◆ GetPosition()

const decDVector& deTouchSensor::GetPosition ( ) const
inline

Position.

◆ GetShape()

const decShapeList& deTouchSensor::GetShape ( ) const
inline

Shape.

◆ GetTrackEnterLeave()

bool deTouchSensor::GetTrackEnterLeave ( ) const
inline

Touch sensor tracks objects entering and leaving shapes.

◆ HasIgnoreCollider()

bool deTouchSensor::HasIgnoreCollider ( deCollider collider) const

Collider to ignore is present.

◆ IsEmpty()

bool deTouchSensor::IsEmpty ( ) const

Touch sensor contains colliders.

◆ NotifyColliderEntered()

void deTouchSensor::NotifyColliderEntered ( deCollider collider)

Notify scripting module peer collider entered touch sensor.

Parameters
colliderCollider entering the shape.

◆ NotifyColliderLeft()

void deTouchSensor::NotifyColliderLeft ( deCollider collider)

Notify scripting module peer collider left touch sensor.

Parameters
colliderCollider entering the shape.

◆ PointInside()

bool deTouchSensor::PointInside ( const decDVector point)

Test if a point is located inside the touch sensor.

◆ RayHits()

void deTouchSensor::RayHits ( const decDVector rayOrigin,
const decVector rayDirection,
deBaseScriptingCollider listener 
)

Test 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.

◆ RemoveAllIgnoreColliders()

void deTouchSensor::RemoveAllIgnoreColliders ( )

Remove all colliders to ignore.

◆ RemoveIgnoreCollider()

void deTouchSensor::RemoveIgnoreCollider ( deCollider collider)

Remove collider to ignore.

Exceptions
deeInvalidParamcollider is absent.

◆ SetCollisionFilter()

void deTouchSensor::SetCollisionFilter ( const decCollisionFilter collisionFilter)

Set collision filter.

◆ SetEnabled()

void deTouchSensor::SetEnabled ( bool  enabled)

Set if touch sensor is enabled.

◆ SetLLWorldNext()

void deTouchSensor::SetLLWorldNext ( deTouchSensor touchSensor)

Set next touch sensor in the parent world linked list.

◆ SetLLWorldPrev()

void deTouchSensor::SetLLWorldPrev ( deTouchSensor touchSensor)

Set next touch sensor in the parent world linked list.

◆ SetOrientation()

void deTouchSensor::SetOrientation ( const decQuaternion orientation)

Set orientation.

◆ SetParentWorld()

void deTouchSensor::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerPhysics()

void deTouchSensor::SetPeerPhysics ( deBasePhysicsTouchSensor peer)

Set physics system peer.

◆ SetPeerScripting()

void deTouchSensor::SetPeerScripting ( deBaseScriptingTouchSensor peer)

Set scripting system peer.

◆ SetPosition()

void deTouchSensor::SetPosition ( const decDVector position)

Set position.

◆ SetShape()

void deTouchSensor::SetShape ( const decShapeList shape)

Set shape.

◆ SetTrackEnterLeave()

void deTouchSensor::SetTrackEnterLeave ( bool  trackEnterLeave)

Set if touch sensor tracks objects entering and leaving shapes.


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