Drag[en]gine Script Module DragonScript
1.23
|
Public Member Functions | |
Attachments | |
int | getAttachmentCount () |
Number of attachments. More... | |
Object | getAttachedResource (int index) |
Resource of attachment at index. More... | |
void | attachStatic (Object resource) |
Attach resource using static mode relative to current position. More... | |
void | attachStatic (Object resource, Vector position, Quaternion orientation) |
Attach resource using static mode with specific position. More... | |
void | attachRelativeMovement (Object resource) |
Attach collider keeping relative position and orientation. More... | |
void | detach (Object resource) |
Detach resource. More... | |
void | detachAll () |
Detach all resources. More... | |
void | attachmentsForceUpdate () |
Force update of all attachments. More... | |
Constraints | |
int | getConstraintCount () |
Number of constraints. More... | |
void | addConstraint (ColliderConstraint constraint) |
Add constraint from a collider constraint. More... | |
bool | hasConstraint (ColliderConstraint constraint) |
Constraint with same bone, target collider and target bone is present. More... | |
int | indexOfConstraint (ColliderConstraint constraint) |
Index of constraint with same bone, target collider and target bone or -1 if absent. More... | |
ColliderConstraint | getConstraintAt (int index) |
Constraint at index. More... | |
void | setConstraintAt (int index, ColliderConstraint constraint) |
Set constraint from a collider constraint. More... | |
void | removeConstraint (ColliderConstraint constraint) |
Remove constraint with same bone, target collider and target bone. More... | |
void | removeConstraintFrom (int index) |
Remove constraint from index. More... | |
void | removeAllConstraints () |
Remove all constraints. More... | |
Ignore colliders | |
int | getIgnoreColliderCount () |
Number of colliders to ignore. More... | |
Collider | getIgnoreColliderAt (int index) |
Ignore collider at index. More... | |
bool | hasIgnoreCollider (Collider collider) |
Ignore collider is present. More... | |
void | addIgnoreCollider (Collider collider) |
Add collider to ignore. More... | |
void | removeIgnoreCollider (Collider collider) |
Remove collider to ignore. More... | |
void | removeAllIgnoreColliders () |
Remove all colliders to ignore. More... | |
Post physics collision tests | |
int | getCollisionTestCount () |
Number of post physics collision tests. More... | |
ColliderCollisionTest | getCollisionTestAt (int index) |
Post physics collision test at index. More... | |
void | addCollisionTest (ColliderCollisionTest collisionTest) |
Add post physics collision test. More... | |
void | removeCollisionTest (ColliderCollisionTest collisionTest) |
Remove post physics collision test. More... | |
void | removeAllCollisionTests () |
Remove all post physics collision tests. More... | |
Force and Impuls | |
void | applyImpuls (Vector impuls) |
Apply impulse at central mass point. More... | |
void | applyImpulsAt (Vector impuls, Vector position) |
Apply impulse at position. More... | |
void | applyTorque (Vector torque) |
Apply torque at central mass point. More... | |
void | applyTorqueImpuls (Vector torqueImpuls) |
Apply torque and impulse at center mass point. More... | |
void | applyForce (Vector force) |
Apply force at central mass point. More... | |
void | applyForceAt (Vector force, Vector position) |
Apply force at position. More... | |
Notifications | |
ColliderListener | getColliderListener () |
Collider listener or null if not set. More... | |
void | setColliderListener (ColliderListener listener) |
Set collider listener or null to clear. More... | |
bool | colliderListenerGetCustomCanHit () |
Custom can hit callback is enabled. More... | |
void | colliderListenerSetCustomCanHit (bool customCanHit) |
Set if custom can hit callback is enabled. More... | |
ColliderBreakingListener | getBreakingListener () |
Breaking listener or null if not set. More... | |
void | setBreakingListener (ColliderBreakingListener listener) |
Set breaking listener or null if not set. More... | |
Collision detection | |
bool | pointInside (DVector point) |
Point is inside collider. More... | |
void | rayHits (DVector rayOrigin, Vector rayDirection, ColliderListener listener) |
Ray cast intersection test. More... | |
void | rayHitsClosest (DVector rayOrigin, Vector rayDirection, ColliderListener listener) |
Closest ray cast intersection test. More... | |
void | colliderHits (Collider collider, ColliderListener listener) |
Test collider for intersection. More... | |
void | colliderMoveHits (Collider collider, Vector displacement, ColliderListener listener) |
Tests moving collider for collision. More... | |
void | colliderMoveHitsCLosest (Collider collider, Vector displacement, ColliderListener listener) |
Tests moving collider for collision. More... | |
void | colliderRotateHits (Collider collider, ColliderListener listener) |
Test rotating collider for collision. More... | |
void | colliderRotateHitsClosest (Collider collider, ColliderListener listener) |
Test rotating collider for collision. More... | |
void | colliderMoveRotateHits (Collider collider, Vector displacement, ColliderListener listener) |
Test moving and rotating collider for collision. More... | |
void | colliderMoveRotateHitsClosest (Collider collider, Vector displacement, ColliderListener listener) |
Test moving and rotating collider for collision. More... | |
Protected Member Functions | |
Constructors | |
Collider | new () |
Create collider. More... | |
Management | |
DVector | getPosition () |
Position. More... | |
void | setPosition (DVector position) |
Set position. More... | |
Quaternion | getOrientation () |
Oorientation. More... | |
void | setOrientation (Quaternion orientation) |
Set orientation. More... | |
Vector | getScale () |
Scale. More... | |
void | setScale (Vector scale) |
Set scale. More... | |
void | setGeometry (DVector position, Quaternion orientation) |
Set position and orientation at the same time. More... | |
void | setGeometry (DVector position, Quaternion orientation, Vector scale) |
Set position and orientation at the same time. More... | |
Vector | getView () |
View direction. More... | |
Vector | getUp () |
Up direction. More... | |
Vector | getRight () |
Right direction. More... | |
DMatrix | getMatrix () |
Get matrix. More... | |
DMatrix | getInverseMatrix () |
Get inverse matrix. More... | |
Vector | getLinearVelocity () |
Linear velocity in m/s. More... | |
void | setLinearVelocity (Vector linVelo) |
Set linear velocity in m/s. More... | |
Vector | getAngularVelocity () |
Angular velocity in degrees/s. More... | |
void | setAngularVelocity (Vector angVelo) |
Set angular velocity degrees/s. More... | |
float | getMass () |
Mass in kg. More... | |
void | setMass (float mass) |
Set mass in kg. More... | |
Vector | getGravity () |
Constant acceleration in N/s^2. More... | |
void | setGravity (Vector force) |
Set constant acceleration in N/s^2. More... | |
bool | getEnabled () |
Collider is enabled. More... | |
void | setEnabled (bool enabled) |
Set if collider is enabled. More... | |
CollisionResponse | getResponseType () |
Response type. More... | |
void | setResponseType (CollisionResponse responseType) |
Set response type. More... | |
bool | getUseLocalGravity () |
Collider defined gravity is used instead of World gravity. More... | |
void | setUseLocalGravity (bool useLocalGravity) |
Set if collider defined gravity is used instead of World gravity. More... | |
Object | getOwner () |
Object owning the collider for interaction or null if not used. More... | |
void | setOwner (Object owner) |
Set object owning the collider for interaction or null if not used. More... | |
float | getForceFieldDirect () |
Factor for direct type force fields. More... | |
void | setForceFieldDirect (float factor) |
Set factor for direct type force fields. More... | |
float | getForceFieldSurface () |
Factor for surface type force fields. More... | |
void | setForceFieldSurface (float factor) |
Set factor for surface type force fields. More... | |
float | getForceFieldMass () |
Factor for mass type force fields. More... | |
void | setForceFieldMass (float factor) |
Set factor for mass type force fields. More... | |
float | getForceFieldSpeed () |
Factor for speed type force fields. More... | |
void | setForceFieldSpeed (float factor) |
Set factor for speed type force fields. More... | |
CollisionFilter | getCollisionFilter () |
Collision filter. More... | |
void | setCollisionFilter (CollisionFilter collisionFilter) |
Set collision filter. More... | |
bool | equals (Object other) |
Collider is equal to another object. More... | |
int | hashCode () |
Hash code for use as dictionary keys. More... | |
static bool | equals (Collider collider1, Collider collider2) |
Two colliders are equal. More... | |
Colliders provide collision detection and physical simulation to world objects. Colliders can be static (where they do not move), kinematic (where the game scripts provide physics response) or dynamic (where the physics module provides the physics response). Colliders can be a shape (ColliderVolume) or a articulated (ColliderRig or ColliderComponent). Colliders can be linked to other colliders using constraints (ColliderConstraint). ColliderRig and ColliderComponent use also rig defined constraints which are automatically created while external constraints are created by the game scripts.
All resources with a position and orientation can be attached to a collider or bone if articulated. The following resources can be attached:
This is a native class.
void Dragengine.Scenery.Collider.addCollisionTest | ( | ColliderCollisionTest | collisionTest | ) |
Add post physics collision test.
void Dragengine.Scenery.Collider.addConstraint | ( | ColliderConstraint | constraint | ) |
Add constraint from a collider constraint.
EInvalidParam | Constraint with same bone, target collider and target bone is present. |
void Dragengine.Scenery.Collider.addIgnoreCollider | ( | Collider | collider | ) |
Add collider to ignore.
void Dragengine.Scenery.Collider.applyForce | ( | Vector | force | ) |
Apply force at central mass point.
Apply force at position.
void Dragengine.Scenery.Collider.applyImpuls | ( | Vector | impuls | ) |
Apply impulse at central mass point.
Apply impulse at position.
void Dragengine.Scenery.Collider.applyTorque | ( | Vector | torque | ) |
Apply torque at central mass point.
void Dragengine.Scenery.Collider.applyTorqueImpuls | ( | Vector | torqueImpuls | ) |
Apply torque and impulse at center mass point.
void Dragengine.Scenery.Collider.attachmentsForceUpdate | ( | ) |
Force update of all attachments.
You have to call this if want to reset colliders and components to a predefined state like after warping or resetting objects. This requires an attachment update outside the regular physics simulation run by the physics module to prevent exploding behavior.
void Dragengine.Scenery.Collider.attachRelativeMovement | ( | Object | resource | ) |
Attach collider keeping relative position and orientation.
void Dragengine.Scenery.Collider.attachStatic | ( | Object | resource | ) |
Attach resource using static mode relative to current position.
void Dragengine.Scenery.Collider.attachStatic | ( | Object | resource, |
Vector | position, | ||
Quaternion | orientation | ||
) |
Attach resource using static mode with specific position.
void Dragengine.Scenery.Collider.colliderHits | ( | Collider | collider, |
ColliderListener | listener | ||
) |
Test collider for intersection.
bool Dragengine.Scenery.Collider.colliderListenerGetCustomCanHit | ( | ) |
Custom can hit callback is enabled.
void Dragengine.Scenery.Collider.colliderListenerSetCustomCanHit | ( | bool | customCanHit | ) |
Set if custom can hit callback is enabled.
void Dragengine.Scenery.Collider.colliderMoveHits | ( | Collider | collider, |
Vector | displacement, | ||
ColliderListener | listener | ||
) |
Tests moving collider for collision.
void Dragengine.Scenery.Collider.colliderMoveHitsCLosest | ( | Collider | collider, |
Vector | displacement, | ||
ColliderListener | listener | ||
) |
Tests moving collider for collision.
void Dragengine.Scenery.Collider.colliderMoveRotateHits | ( | Collider | collider, |
Vector | displacement, | ||
ColliderListener | listener | ||
) |
Test moving and rotating collider for collision.
void Dragengine.Scenery.Collider.colliderMoveRotateHitsClosest | ( | Collider | collider, |
Vector | displacement, | ||
ColliderListener | listener | ||
) |
Test moving and rotating collider for collision.
void Dragengine.Scenery.Collider.colliderRotateHits | ( | Collider | collider, |
ColliderListener | listener | ||
) |
Test rotating collider for collision.
void Dragengine.Scenery.Collider.colliderRotateHitsClosest | ( | Collider | collider, |
ColliderListener | listener | ||
) |
Test rotating collider for collision.
void Dragengine.Scenery.Collider.detach | ( | Object | resource | ) |
Detach resource.
void Dragengine.Scenery.Collider.detachAll | ( | ) |
Detach all resources.
Two colliders are equal.
This is an extended version of equals() accepting also null for collider1 and collider2. equals() would thrown an exception if null is compared to anything. This call though allows to compare null against colliders or even null itself. If collider1 or collider2 is null false is returned. If both are null true is returned.
Reimplemented in Dragengine.Scenery.ColliderVolume, Dragengine.Scenery.ColliderRig, and Dragengine.Scenery.ColliderComponent.
bool Dragengine.Scenery.Collider.equals | ( | Object | other | ) |
Collider is equal to another object.
Implements Object.equals(Object).
Reimplemented in Dragengine.Scenery.ColliderVolume, Dragengine.Scenery.ColliderRig, and Dragengine.Scenery.ColliderComponent.
Vector Dragengine.Scenery.Collider.getAngularVelocity | ( | ) |
Angular velocity in degrees/s.
Object Dragengine.Scenery.Collider.getAttachedResource | ( | int | index | ) |
Resource of attachment at index.
EOutOfBoundary | index is less than 0 or larger than or equal to getAttachmentCount(). |
int Dragengine.Scenery.Collider.getAttachmentCount | ( | ) |
Number of attachments.
ColliderBreakingListener Dragengine.Scenery.Collider.getBreakingListener | ( | ) |
Breaking listener or null if not set.
ColliderListener Dragengine.Scenery.Collider.getColliderListener | ( | ) |
Collider listener or null if not set.
CollisionFilter Dragengine.Scenery.Collider.getCollisionFilter | ( | ) |
Collision filter.
ColliderCollisionTest Dragengine.Scenery.Collider.getCollisionTestAt | ( | int | index | ) |
Post physics collision test at index.
deeInvalidParam | index is less than 0 or equal than or equal to getCollisionTestCount(). |
int Dragengine.Scenery.Collider.getCollisionTestCount | ( | ) |
Number of post physics collision tests.
ColliderConstraint Dragengine.Scenery.Collider.getConstraintAt | ( | int | index | ) |
Constraint at index.
EOutOfBoundary | index is less than 0 or larger than or equal to getConstraintCount(). |
int Dragengine.Scenery.Collider.getConstraintCount | ( | ) |
Number of constraints.
bool Dragengine.Scenery.Collider.getEnabled | ( | ) |
Collider is enabled.
float Dragengine.Scenery.Collider.getForceFieldDirect | ( | ) |
Factor for direct type force fields.
float Dragengine.Scenery.Collider.getForceFieldMass | ( | ) |
Factor for mass type force fields.
float Dragengine.Scenery.Collider.getForceFieldSpeed | ( | ) |
Factor for speed type force fields.
float Dragengine.Scenery.Collider.getForceFieldSurface | ( | ) |
Factor for surface type force fields.
Vector Dragengine.Scenery.Collider.getGravity | ( | ) |
Constant acceleration in N/s^2.
Collider Dragengine.Scenery.Collider.getIgnoreColliderAt | ( | int | index | ) |
Ignore collider at index.
deeInvalidParam | index is less than 0 or equal than or equal to getIgnoreColliderCount(). |
int Dragengine.Scenery.Collider.getIgnoreColliderCount | ( | ) |
Number of colliders to ignore.
DMatrix Dragengine.Scenery.Collider.getInverseMatrix | ( | ) |
Get inverse matrix.
Vector Dragengine.Scenery.Collider.getLinearVelocity | ( | ) |
Linear velocity in m/s.
float Dragengine.Scenery.Collider.getMass | ( | ) |
Mass in kg.
DMatrix Dragengine.Scenery.Collider.getMatrix | ( | ) |
Get matrix.
Quaternion Dragengine.Scenery.Collider.getOrientation | ( | ) |
Oorientation.
Object Dragengine.Scenery.Collider.getOwner | ( | ) |
Object owning the collider for interaction or null if not used.
DVector Dragengine.Scenery.Collider.getPosition | ( | ) |
Position.
CollisionResponse Dragengine.Scenery.Collider.getResponseType | ( | ) |
Response type.
Vector Dragengine.Scenery.Collider.getRight | ( | ) |
Right direction.
Vector Dragengine.Scenery.Collider.getScale | ( | ) |
Scale.
Vector Dragengine.Scenery.Collider.getUp | ( | ) |
Up direction.
bool Dragengine.Scenery.Collider.getUseLocalGravity | ( | ) |
Vector Dragengine.Scenery.Collider.getView | ( | ) |
View direction.
bool Dragengine.Scenery.Collider.hasConstraint | ( | ColliderConstraint | constraint | ) |
Constraint with same bone, target collider and target bone is present.
int Dragengine.Scenery.Collider.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
Reimplemented in Dragengine.Scenery.ColliderVolume, Dragengine.Scenery.ColliderRig, and Dragengine.Scenery.ColliderComponent.
bool Dragengine.Scenery.Collider.hasIgnoreCollider | ( | Collider | collider | ) |
Ignore collider is present.
int Dragengine.Scenery.Collider.indexOfConstraint | ( | ColliderConstraint | constraint | ) |
Index of constraint with same bone, target collider and target bone or -1 if absent.
|
protected |
Create collider.
Reimplemented in Dragengine.Scenery.ColliderVolume, Dragengine.Scenery.ColliderRig, and Dragengine.Scenery.ColliderComponent.
bool Dragengine.Scenery.Collider.pointInside | ( | DVector | point | ) |
Point is inside collider.
void Dragengine.Scenery.Collider.rayHits | ( | DVector | rayOrigin, |
Vector | rayDirection, | ||
ColliderListener | listener | ||
) |
Ray cast intersection test.
void Dragengine.Scenery.Collider.rayHitsClosest | ( | DVector | rayOrigin, |
Vector | rayDirection, | ||
ColliderListener | listener | ||
) |
Closest ray cast intersection test.
Only closest intersection is reported to listener. rayHits() reports all intersections.
void Dragengine.Scenery.Collider.removeAllCollisionTests | ( | ) |
Remove all post physics collision tests.
void Dragengine.Scenery.Collider.removeAllConstraints | ( | ) |
Remove all constraints.
void Dragengine.Scenery.Collider.removeAllIgnoreColliders | ( | ) |
Remove all colliders to ignore.
void Dragengine.Scenery.Collider.removeCollisionTest | ( | ColliderCollisionTest | collisionTest | ) |
Remove post physics collision test.
deeInvalidParam | collisionTest is absent. |
void Dragengine.Scenery.Collider.removeConstraint | ( | ColliderConstraint | constraint | ) |
Remove constraint with same bone, target collider and target bone.
EInvalidParam | Matching constraint is absent. |
void Dragengine.Scenery.Collider.removeConstraintFrom | ( | int | index | ) |
Remove constraint from index.
EOutOfBoundary | index is less than 0 or larger than or equal to getConstraintCount(). |
void Dragengine.Scenery.Collider.removeIgnoreCollider | ( | Collider | collider | ) |
Remove collider to ignore.
deeInvalidParam | collider is absent. |
void Dragengine.Scenery.Collider.setAngularVelocity | ( | Vector | angVelo | ) |
Set angular velocity degrees/s.
void Dragengine.Scenery.Collider.setBreakingListener | ( | ColliderBreakingListener | listener | ) |
Set breaking listener or null if not set.
void Dragengine.Scenery.Collider.setColliderListener | ( | ColliderListener | listener | ) |
Set collider listener or null to clear.
void Dragengine.Scenery.Collider.setCollisionFilter | ( | CollisionFilter | collisionFilter | ) |
Set collision filter.
void Dragengine.Scenery.Collider.setConstraintAt | ( | int | index, |
ColliderConstraint | constraint | ||
) |
Set constraint from a collider constraint.
EOutOfBoundary | index is less than 0 or larger than or equal to getConstraintCount(). |
EInvalidParam | New constraint has different bone, target collider or target bone. |
void Dragengine.Scenery.Collider.setEnabled | ( | bool | enabled | ) |
Set if collider is enabled.
void Dragengine.Scenery.Collider.setForceFieldDirect | ( | float | factor | ) |
Set factor for direct type force fields.
void Dragengine.Scenery.Collider.setForceFieldMass | ( | float | factor | ) |
Set factor for mass type force fields.
void Dragengine.Scenery.Collider.setForceFieldSpeed | ( | float | factor | ) |
Set factor for speed type force fields.
void Dragengine.Scenery.Collider.setForceFieldSurface | ( | float | factor | ) |
Set factor for surface type force fields.
void Dragengine.Scenery.Collider.setGeometry | ( | DVector | position, |
Quaternion | orientation | ||
) |
Set position and orientation at the same time.
Colliders are the only resources supporting attachments. Using SetPosition() and SetOrientation() causes attachments to be repositions immediately. If many resources are attached to the collider (perhaps even nested) this can reduce performance since attachments are potentially repositioned twice. This call ensures attachments are only repositioned once improving performance.
void Dragengine.Scenery.Collider.setGeometry | ( | DVector | position, |
Quaternion | orientation, | ||
Vector | scale | ||
) |
Set position and orientation at the same time.
Colliders are the only resources supporting attachments. Using SetPosition() and SetOrientation() causes attachments to be repositions immediately. If many resources are attached to the collider (perhaps even nested) this can reduce performance since attachments are potentially repositioned twice. This call ensures attachments are only repositioned once improving performance.
void Dragengine.Scenery.Collider.setGravity | ( | Vector | force | ) |
Set constant acceleration in N/s^2.
void Dragengine.Scenery.Collider.setLinearVelocity | ( | Vector | linVelo | ) |
Set linear velocity in m/s.
void Dragengine.Scenery.Collider.setMass | ( | float | mass | ) |
Set mass in kg.
void Dragengine.Scenery.Collider.setOrientation | ( | Quaternion | orientation | ) |
Set orientation.
void Dragengine.Scenery.Collider.setOwner | ( | Object | owner | ) |
Set object owning the collider for interaction or null if not used.
void Dragengine.Scenery.Collider.setPosition | ( | DVector | position | ) |
Set position.
void Dragengine.Scenery.Collider.setResponseType | ( | CollisionResponse | responseType | ) |
Set response type.
void Dragengine.Scenery.Collider.setScale | ( | Vector | scale | ) |
Set scale.
For deColliderComponent the scaling is used from the set deComponent in the first place. The collider scaling is applied on top of it. Hence if you use deColliderComponent with scaled components you do not have to set the scaling on the deColliderComponent. For deColliderVolume and deColliderRig using scaling is required.
void Dragengine.Scenery.Collider.setUseLocalGravity | ( | bool | useLocalGravity | ) |
Set if collider defined gravity is used instead of World gravity.