Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ColliderCollisionTest Class Reference

Collider collision test. More...

Inheritance diagram for Dragengine.Scenery.ColliderCollisionTest:

Public Member Functions

Constructors
ColliderCollisionTest new ()
 Create collider collision test. More...
 
ColliderCollisionTest new (ColliderCollisionTest collisionTest)
 Create copy of collider collision test. More...
 
ColliderCollisionTest new (CollisionFilter collisionFilter, Vector origin, Vector direction)
 Create collider collision test. More...
 
ColliderCollisionTest new (CollisionFilter collisionFilter, Component component, String bone, Vector origin, Vector direction)
 Create a collider collision test. More...
 
ColliderCollisionTest new (TouchSensor touchSensor, CollisionFilter collisionFilter, Vector origin, Vector direction)
 Create collider collision test. More...
 
ColliderCollisionTest new (TouchSensor touchSensor, CollisionFilter collisionFilter, Component component, String bone, Vector origin, Vector direction)
 Create a collider collision test. More...
 
Test Configuration
TouchSensor getTouchSensor ()
 Touch sensor to use for testing collisions or null if not set. More...
 
void setTouchSensor (TouchSensor touchSensor)
 Set touch sensor to use for testing collisions or null if not set. More...
 
Collider getCollider ()
 Collider or null to test using a ray. More...
 
void setCollider (Collider collider)
 Set collider or null to test using a ray. More...
 
CollisionFilter getCollisionFilter ()
 Collision filter. More...
 
void setCollisionFilter (CollisionFilter collisionFilter)
 Set collision filter. More...
 
Component getComponent ()
 Component to use to retrieve bone position from or NULL if not used. More...
 
void setComponent (Component component)
 Set component to use to retrieve bone position from or NULL if not used. More...
 
String getBone ()
 Bone to apply origin to for testing or empty string to use parent collider position. More...
 
void setBone (String name)
 Set bone to apply origin to for testing or empty string to use parent collider position. More...
 
Vector getOrigin ()
 Cast origin. More...
 
void setOrigin (Vector origin)
 Set cast origin. More...
 
Quaternion getOrientation ()
 Cast orientation. More...
 
void setOrientation (Quaternion orientation)
 Set cast orientation. More...
 
Vector getDirection ()
 Cast direction. More...
 
void setDirection (Vector direction)
 Set cast direction. More...
 
bool getLocalDirection ()
 Local direction. More...
 
void setLocalDirection (bool localDirection)
 Set if direction is local. More...
 
bool getEnabled ()
 Collision tets is enabled. More...
 
void setEnabled (bool enabled)
 Set if collision test is enabled. More...
 
Test Result
DVector getTestOrigin ()
 Test origin used by physics module during the last update. More...
 
Quaternion getTestOrientation ()
 Test orientation used by physics module during the last update. More...
 
DVector getTestDirection ()
 Test direction used by physics module during the last update. More...
 
bool getHasCollision ()
 Collision has been found. More...
 
int getCollisionCount ()
 Number of found collisions. More...
 
CollisionInfo getCollisionAt (int index)
 Collision at index. More...
 
void reset ()
 Remove all collisions reverting test to no collision found state. More...
 
float hitDistance (int index)
 Direction length multiplied by hit distance. More...
 
Vector hitPointCollider (int index)
 Hit point in collider space. More...
 
DVector hitPointWorld (int index)
 Hit point in world space. More...
 
Vector hitNormalCollider (int index)
 Hit normal in collider space. More...
 
Vector hitNormalWorld (int index)
 Hit normal in world space. More...
 
Collider hitCollider (int index)
 Hit collider or null if hit object is not a collider. More...
 
int hitBone (int index)
 Hit bone or -1 if hit object is not a collider. More...
 

Detailed Description

Collider collision test.

Collision test to perform by the physics module after parent collider has been moved. This allows to perform repeated collision tests in high performance way. Multiple collision tests can be assigned to a collider at any time even during collision response. The physics module performs these tests whenever collider simulation is finished. Typical usage for tests are testing ground after actor moved to plant it firmly on the ground.

After physics simulation is finished the result can be obtained from the collision test object. The collision test contains a list of all found collisions. If a test direction has been set (not zero vector) the list is sorted by distance with the closest collision at index 0. Otherwise the list is unsorted.

Physics modules redo collision tests if they figure out something changed and a new test would potentially provide different results. It is thus not guaranteed these tests are done every frame so do not modify the results only the test parameters.

By default local direction is used hence collision testing is relative to the position and orientation of the owner collider. To use world coordinate system call setLocalDirection(false). This allows direction to be always the same.

This is a native class.

Warning

The game engine does not track the parent collider inside the collider collision test itself. The ColliderCollisionTest script class does track the parent collider. Do not add a ColliderCollisionTest to more than one collider at the same time. Doing so will falsify method calls relaying on the parent collider to be properly set.

Member Function Documentation

◆ getBone()

String Dragengine.Scenery.ColliderCollisionTest.getBone ( )

Bone to apply origin to for testing or empty string to use parent collider position.

◆ getCollider()

Collider Dragengine.Scenery.ColliderCollisionTest.getCollider ( )

Collider or null to test using a ray.

◆ getCollisionAt()

CollisionInfo Dragengine.Scenery.ColliderCollisionTest.getCollisionAt ( int  index)

Collision at index.

◆ getCollisionCount()

int Dragengine.Scenery.ColliderCollisionTest.getCollisionCount ( )

Number of found collisions.

◆ getCollisionFilter()

CollisionFilter Dragengine.Scenery.ColliderCollisionTest.getCollisionFilter ( )

Collision filter.

◆ getComponent()

Component Dragengine.Scenery.ColliderCollisionTest.getComponent ( )

Component to use to retrieve bone position from or NULL if not used.

◆ getDirection()

Vector Dragengine.Scenery.ColliderCollisionTest.getDirection ( )

Cast direction.

◆ getEnabled()

bool Dragengine.Scenery.ColliderCollisionTest.getEnabled ( )

Collision tets is enabled.

◆ getHasCollision()

bool Dragengine.Scenery.ColliderCollisionTest.getHasCollision ( )

Collision has been found.

◆ getLocalDirection()

bool Dragengine.Scenery.ColliderCollisionTest.getLocalDirection ( )

Local direction.

◆ getOrientation()

Quaternion Dragengine.Scenery.ColliderCollisionTest.getOrientation ( )

Cast orientation.

Version
1.16

◆ getOrigin()

Vector Dragengine.Scenery.ColliderCollisionTest.getOrigin ( )

Cast origin.

◆ getTestDirection()

DVector Dragengine.Scenery.ColliderCollisionTest.getTestDirection ( )

Test direction used by physics module during the last update.

◆ getTestOrientation()

Quaternion Dragengine.Scenery.ColliderCollisionTest.getTestOrientation ( )

Test orientation used by physics module during the last update.

Version
1.16

◆ getTestOrigin()

DVector Dragengine.Scenery.ColliderCollisionTest.getTestOrigin ( )

Test origin used by physics module during the last update.

◆ getTouchSensor()

TouchSensor Dragengine.Scenery.ColliderCollisionTest.getTouchSensor ( )

Touch sensor to use for testing collisions or null if not set.

◆ hitBone()

int Dragengine.Scenery.ColliderCollisionTest.hitBone ( int  index)

Hit bone or -1 if hit object is not a collider.

◆ hitCollider()

Collider Dragengine.Scenery.ColliderCollisionTest.hitCollider ( int  index)

Hit collider or null if hit object is not a collider.

◆ hitDistance()

float Dragengine.Scenery.ColliderCollisionTest.hitDistance ( int  index)

Direction length multiplied by hit distance.

◆ hitNormalCollider()

Vector Dragengine.Scenery.ColliderCollisionTest.hitNormalCollider ( int  index)

Hit normal in collider space.

◆ hitNormalWorld()

Vector Dragengine.Scenery.ColliderCollisionTest.hitNormalWorld ( int  index)

Hit normal in world space.

◆ hitPointCollider()

Vector Dragengine.Scenery.ColliderCollisionTest.hitPointCollider ( int  index)

Hit point in collider space.

◆ hitPointWorld()

DVector Dragengine.Scenery.ColliderCollisionTest.hitPointWorld ( int  index)

Hit point in world space.

◆ new() [1/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( )

Create collider collision test.

◆ new() [2/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( ColliderCollisionTest  collisionTest)

Create copy of collider collision test.

◆ new() [3/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( CollisionFilter  collisionFilter,
Component  component,
String  bone,
Vector  origin,
Vector  direction 
)

Create a collider collision test.

◆ new() [4/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( CollisionFilter  collisionFilter,
Vector  origin,
Vector  direction 
)

Create collider collision test.

◆ new() [5/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( TouchSensor  touchSensor,
CollisionFilter  collisionFilter,
Component  component,
String  bone,
Vector  origin,
Vector  direction 
)

Create a collider collision test.

◆ new() [6/6]

ColliderCollisionTest Dragengine.Scenery.ColliderCollisionTest.new ( TouchSensor  touchSensor,
CollisionFilter  collisionFilter,
Vector  origin,
Vector  direction 
)

Create collider collision test.

◆ reset()

void Dragengine.Scenery.ColliderCollisionTest.reset ( )

Remove all collisions reverting test to no collision found state.

◆ setBone()

void Dragengine.Scenery.ColliderCollisionTest.setBone ( String  name)

Set bone to apply origin to for testing or empty string to use parent collider position.

◆ setCollider()

void Dragengine.Scenery.ColliderCollisionTest.setCollider ( Collider  collider)

Set collider or null to test using a ray.

◆ setCollisionFilter()

void Dragengine.Scenery.ColliderCollisionTest.setCollisionFilter ( CollisionFilter  collisionFilter)

Set collision filter.

◆ setComponent()

void Dragengine.Scenery.ColliderCollisionTest.setComponent ( Component  component)

Set component to use to retrieve bone position from or NULL if not used.

◆ setDirection()

void Dragengine.Scenery.ColliderCollisionTest.setDirection ( Vector  direction)

Set cast direction.

◆ setEnabled()

void Dragengine.Scenery.ColliderCollisionTest.setEnabled ( bool  enabled)

Set if collision test is enabled.

◆ setLocalDirection()

void Dragengine.Scenery.ColliderCollisionTest.setLocalDirection ( bool  localDirection)

Set if direction is local.

◆ setOrientation()

void Dragengine.Scenery.ColliderCollisionTest.setOrientation ( Quaternion  orientation)

Set cast orientation.

Version
1.16

◆ setOrigin()

void Dragengine.Scenery.ColliderCollisionTest.setOrigin ( Vector  origin)

Set cast origin.

◆ setTouchSensor()

void Dragengine.Scenery.ColliderCollisionTest.setTouchSensor ( TouchSensor  touchSensor)

Set touch sensor to use for testing collisions or null if not set.


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