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