Class R.struct.CollisionData
Extends
R.engine.PooledObject.
An object which contains information about a collision. The values of the
collision data are read directly.
Defined in: collisiondata.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.struct.CollisionData(o, u, s1, s2, i, wt, dt)
Creates a collision data structure.
|
Field Attributes | Field Name and Description |
---|---|
The time delta between the world time and the last time the engine was updated
|
|
A vector which can be used to move the two objects apart so they aren't colliding
|
|
The overlap in pixels
|
|
The game object which collided
|
|
The game object that was collided with
|
|
The collision normal
|
|
The world time at the time of the collision
|
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroy the collision data object.
|
|
release()
Release the collision data object back into the pool for reuse.
|
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.struct.CollisionData(o, u, s1, s2, i, wt, dt)
Creates a collision data structure.
- Parameters:
- o
- {Number} Overlap
- u
- {R.math.Vector2D} The collision normal
- s1
- {R.engine.GameObject} Game object 1
- s2
- {R.engine.GameObject} Game object 2
- i
- {R.math.Vector2D} Impulse vector to separate shapes
- wt
- {Number} World time
- dt
- {Number} Time since last frame redraw (delta time)
Field Detail
delta
The time delta between the world time and the last time the engine was updated
impulseVector
A vector which can be used to move the two objects apart so they aren't colliding
overlap
The overlap in pixels
shape1
The game object which collided
shape2
The game object that was collided with
unitVector
The collision normal
worldTime
The world time at the time of the collision
Method Detail
destroy()
Destroy the collision data object.
release()
Release the collision data object back into the pool for reuse.