Table Of Contents

Previous topic

9.17. The Shape Object

Next topic

9.19. The RigidBody Object

This Page

9.18. The CollisionObject Object

A CollisionObject object represents an static or kinematic body against which rigid bodies can collide.

9.18.1. Constructor

A CollisionObject object can be constructed with PhysicsDevice.createCollisionObject.

9.18.2. Methods

9.18.2.1. calculateExtents

Summary

Calculates the world extents of the collision object.

Syntax

var extents = [];
collisionObject.calculateExtents(extents);
extents
The world extents of the collision object.

9.18.2.2. clone

Summary

Clones the collision object.

Syntax

var clonedCollisionObject = collisionObject.clone();

Returns a new collision object identical to the original and located at the same position.

9.18.3. Properties

9.18.3.1. transform

Summary

The Matrix43 representing the rotation and location of the collision object.

Changing the transform could be an expensive operation because the internal acceleration structures may need updating. Also, it should only be done for kinematic objects.

Syntax

// Get the current location
var matrix = collisionObject.transform;

// Move it to the origin
collisionObject.transform = mathDevice.m43BuildIdentity();

9.18.3.2. shape

Summary

The Shape object assigned to the collision object.

Syntax

var shape = collisionObject.shape;

Note

Read Only

9.18.3.3. group

Summary

The collision group number assigned to the collision object.

Syntax

var collisionGroup = collisionObject.group;

Note

Read Only

9.18.3.4. mask

Summary

The collision mask number assigned to the collision object.

Syntax

var collisionMask = collisionObject.mask;

Note

Read Only

9.18.3.5. userData

Summary

The user object associated with the collision object.

Syntax

// Get current user object
var sceneOwner = collisionObject.userData;

// Set a new one
collisionObject.userData = doorEntity;

9.18.3.6. friction

Summary

The friction value of the collision object.

Syntax

// Get current friction
var friction = collisionObject.friction;

// Double it
collisionObject.friction = (2.0 * friction);

9.18.3.7. restitution

Summary

The restitution value of the collision object.

Syntax

// Get current restitution
var restitution = collisionObject.restitution;

// Half it
collisionObject.restitution = (0.5 * restitution);

9.18.3.8. kinematic

Summary

True if the collision object was created as kinematic, false otherwise.

Syntax

var isKinematic = collisionObject.kinematic;

Note

Read Only