Drag[en]gine Script Module DragonScript Script API  1.0
Collider Class Reference

Collider. More...

Inheritance diagram for Collider:
ColliderRig ColliderVolume ColliderComponent

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...
 
void setConstaintAt (int index, ColliderConstraint constraint)
 Set constraint from a collider constraint. 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)
 Test collider for intersection. More...
 
void colliderMoveHits (Collider collider, Vector displacement)
 Tests moving collider for collision. More...
 
void colliderRotateHits (Collider collider)
 Test rotating collider for collision. More...
 
void colliderMoveRotateHits (Collider collider, Vector displacement)
 Test moving and rotating collider for collision. More...
 

Static Public Attributes

Collision response modes.
static final int STATIC = 0
 Static response. More...
 
static final int DYNAMIC = 1
 Dynamic collision response. More...
 
static final int KINEMATIC = 2
 Kinematic collision response. 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...
 
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...
 
int getResponseType ()
 Response type. More...
 
void setResponseType (int 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...
 
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...
 

Detailed Description

Collider.

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.

Attachments

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.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ addCollisionTest()

void addCollisionTest ( ColliderCollisionTest  collisionTest)

Add post physics collision test.

§ addConstraint()

void addConstraint ( ColliderConstraint  constraint)

Add constraint from a collider constraint.

§ addIgnoreCollider()

void addIgnoreCollider ( Collider  collider)

Add collider to ignore.

§ applyForce()

void applyForce ( Vector  force)

Apply force at central mass point.

§ applyForceAt()

void applyForceAt ( Vector  force,
Vector  position 
)

Apply force at position.

§ applyImpuls()

void applyImpuls ( Vector  impuls)

Apply impulse at central mass point.

§ applyImpulsAt()

void applyImpulsAt ( Vector  impuls,
Vector  position 
)

Apply impulse at position.

§ applyTorque()

void applyTorque ( Vector  torque)

Apply torque at central mass point.

§ applyTorqueImpuls()

void applyTorqueImpuls ( Vector  torqueImpuls)

Apply torque and impulse at center mass point.

§ attachmentsForceUpdate()

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

§ attachRelativeMovement()

void attachRelativeMovement ( Object  resource)

Attach collider keeping relative position and orientation.

§ attachStatic() [1/2]

void attachStatic ( Object  resource)

Attach resource using static mode relative to current position.

§ attachStatic() [2/2]

void attachStatic ( Object  resource,
Vector  position,
Quaternion  orientation 
)

Attach resource using static mode with specific position.

§ colliderHits()

void colliderHits ( Collider  collider)

Test collider for intersection.

§ colliderListenerGetCustomCanHit()

bool colliderListenerGetCustomCanHit ( )

Custom can hit callback is enabled.

§ colliderListenerSetCustomCanHit()

void colliderListenerSetCustomCanHit ( bool  customCanHit)

Set if custom can hit callback is enabled.

§ colliderMoveHits()

void colliderMoveHits ( Collider  collider,
Vector  displacement 
)

Tests moving collider for collision.

§ colliderMoveRotateHits()

void colliderMoveRotateHits ( Collider  collider,
Vector  displacement 
)

Test moving and rotating collider for collision.

§ colliderRotateHits()

void colliderRotateHits ( Collider  collider)

Test rotating collider for collision.

§ detach()

void detach ( Object  resource)

Detach resource.

§ detachAll()

void detachAll ( )

Detach all resources.

§ equals() [1/2]

bool equals ( Object  other)

Collider is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Collider and both point to the same engine collider.

§ equals() [2/2]

static bool equals ( Collider  collider1,
Collider  collider2 
)
static

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.

§ getAngularVelocity()

Vector getAngularVelocity ( )

Angular velocity in degrees/s.

§ getAttachedResource()

Object getAttachedResource ( int  index)

Resource of attachment at index.

Exceptions
EOutOfBoundaryindex is less than 0 or larger than or equal to getAttachmentCount().

§ getAttachmentCount()

int getAttachmentCount ( )

Number of attachments.

§ getBreakingListener()

ColliderBreakingListener getBreakingListener ( )

Breaking listener or null if not set.

§ getColliderListener()

ColliderListener getColliderListener ( )

Collider listener or null if not set.

§ getCollisionFilter()

CollisionFilter getCollisionFilter ( )

Collision filter.

§ getCollisionTestAt()

ColliderCollisionTest getCollisionTestAt ( int  index)

Post physics collision test at index.

Exceptions
deeInvalidParamindex is less than 0 or equal than or equal to getCollisionTestCount().

§ getCollisionTestCount()

int getCollisionTestCount ( )

Number of post physics collision tests.

§ getConstraintCount()

int getConstraintCount ( )

Number of constraints.

§ getEnabled()

bool getEnabled ( )

Collider is enabled.

§ getForceFieldDirect()

float getForceFieldDirect ( )

Factor for direct type force fields.

§ getForceFieldMass()

float getForceFieldMass ( )

Factor for mass type force fields.

§ getForceFieldSpeed()

float getForceFieldSpeed ( )

Factor for speed type force fields.

§ getForceFieldSurface()

float getForceFieldSurface ( )

Factor for surface type force fields.

§ getGravity()

Vector getGravity ( )

Constant acceleration in N/s^2.

§ getIgnoreColliderAt()

Collider getIgnoreColliderAt ( int  index)

Ignore collider at index.

Exceptions
deeInvalidParamindex is less than 0 or equal than or equal to getIgnoreColliderCount().

§ getIgnoreColliderCount()

int getIgnoreColliderCount ( )

Number of colliders to ignore.

§ getInverseMatrix()

DMatrix getInverseMatrix ( )

Get inverse matrix.

§ getLinearVelocity()

Vector getLinearVelocity ( )

Linear velocity in m/s.

§ getMass()

float getMass ( )

Mass in kg.

§ getMatrix()

DMatrix getMatrix ( )

Get matrix.

§ getOrientation()

Quaternion getOrientation ( )

Oorientation.

§ getPosition()

DVector getPosition ( )

Position.

§ getResponseType()

int getResponseType ( )

Response type.

§ getRight()

Vector getRight ( )

Right direction.

§ getScale()

Vector getScale ( )

Scale.

§ getUp()

Vector getUp ( )

Up direction.

§ getUseLocalGravity()

bool getUseLocalGravity ( )

Collider defined gravity is used instead of World gravity.

§ getView()

Vector getView ( )

View direction.

§ hashCode()

int hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

§ hasIgnoreCollider()

bool hasIgnoreCollider ( Collider  collider)

Ignore collider is present.

§ new()

Collider new ( )
protected

Create collider.

§ pointInside()

bool pointInside ( DVector  point)

Point is inside collider.

§ rayHits()

void rayHits ( DVector  rayOrigin,
Vector  rayDirection,
ColliderListener  listener 
)

Ray cast intersection test.

§ rayHitsClosest()

void rayHitsClosest ( DVector  rayOrigin,
Vector  rayDirection,
ColliderListener  listener 
)

Closest ray cast intersection test.

Only closest intersection is reported to listener. rayHits() reports all intersections.

§ removeAllCollisionTests()

void removeAllCollisionTests ( )

Remove all post physics collision tests.

§ removeAllConstraints()

void removeAllConstraints ( )

Remove all constraints.

§ removeAllIgnoreColliders()

void removeAllIgnoreColliders ( )

Remove all colliders to ignore.

§ removeCollisionTest()

void removeCollisionTest ( ColliderCollisionTest  collisionTest)

Remove post physics collision test.

Exceptions
deeInvalidParamcollisionTest is absent.

§ removeConstraintFrom()

void removeConstraintFrom ( int  index)

Remove constraint from index.

Exceptions
EOutOfBoundaryindex is less than 0 or larger than or equal to getConstraintCount().

§ removeIgnoreCollider()

void removeIgnoreCollider ( Collider  collider)

Remove collider to ignore.

Exceptions
deeInvalidParamcollider is absent.

§ setAngularVelocity()

void setAngularVelocity ( Vector  angVelo)

Set angular velocity degrees/s.

§ setBreakingListener()

void setBreakingListener ( ColliderBreakingListener  listener)

Set breaking listener or null if not set.

§ setColliderListener()

void setColliderListener ( ColliderListener  listener)

Set collider listener or null to clear.

§ setCollisionFilter()

void setCollisionFilter ( CollisionFilter  collisionFilter)

Set collision filter.

§ setConstaintAt()

void setConstaintAt ( int  index,
ColliderConstraint  constraint 
)

Set constraint from a collider constraint.

Exceptions
EOutOfBoundaryindex is less than 0 or larger than or equal to getConstraintCount().

§ setEnabled()

void setEnabled ( bool  enabled)

Set if collider is enabled.

§ setForceFieldDirect()

void setForceFieldDirect ( float  factor)

Set factor for direct type force fields.

§ setForceFieldMass()

void setForceFieldMass ( float  factor)

Set factor for mass type force fields.

§ setForceFieldSpeed()

void setForceFieldSpeed ( float  factor)

Set factor for speed type force fields.

§ setForceFieldSurface()

void setForceFieldSurface ( float  factor)

Set factor for surface type force fields.

§ setGravity()

void setGravity ( Vector  force)

Set constant acceleration in N/s^2.

§ setLinearVelocity()

void setLinearVelocity ( Vector  linVelo)

Set linear velocity in m/s.

§ setMass()

void setMass ( float  mass)

Set mass in kg.

§ setOrientation()

void setOrientation ( Quaternion  orientation)

Set orientation.

§ setPosition()

void setPosition ( DVector  position)

Set position.

§ setResponseType()

void setResponseType ( int  responseType)

Set response type.

Exceptions
EInvalidParamresponseType is not a valid value.

§ setScale()

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

§ setUseLocalGravity()

void setUseLocalGravity ( bool  useLocalGravity)

Set if collider defined gravity is used instead of World gravity.

Member Data Documentation

§ DYNAMIC

final int DYNAMIC = 1
static

Dynamic collision response.

Collider reacts to impacts using physical simulation.

§ KINEMATIC

final int KINEMATIC = 2
static

Kinematic collision response.

Game scripts define the collision response.

§ STATIC

final int STATIC = 0
static

Static response.

Collider is not moving and will not move by collisions.


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