Class: RigidShape

RigidShape

new RigidShape(xform) → {RigidShape}

Default Constructor

Defines a simple rigid shape

Parameters:
Name Type Description
xform Transform Transform object
Source:
Returns:
New instance of RigidShape
Type
RigidShape

Members

(static) eRigidType :enum|eRigidType

Rigid type enum
Type:
  • enum | eRigidType
Source:

Methods

clamp(value, min, max) → {Number}

Clamp value to min and max
Parameters:
Name Type Description
value Number to clamp
min Number Minimum value to clamp too
max Number Maximum value to clamp too
Source:
Returns:
clamped number of value
Type
Number

collidedRectCirc(rect1Shape, circ2Shape, collisionInfo) → {Boolean}

Check for collision between RigidRectangle and RigidCircle
Parameters:
Name Type Description
rect1Shape RigidRectangle Rectangle object to check for collision status
circ2Shape RigidCircle Circle object to check for collision status against
collisionInfo CollisionInfo Collision info of collision
Source:
Returns:
true if collision occurs
Type
Boolean

draw(aCamera) → {void}

Draw function called by GameLoop
Parameters:
Name Type Description
aCamera Camera Camera to draw too
Source:
Returns:
Type
void

getAcceleration() → {Array.<Float>}

Get the Acceleration
Source:
Returns:
current Acceleration [X, Y]
Type
Array.<Float>

getColor() → {Array.<Float>}

Return the Color of the position marker
Source:
Returns:
color of marker [R, G, B, A]
Type
Array.<Float>

getDrawBounds() → {Boolean}

Returns if bound drawing is active
Source:
Returns:
true if bounds are drawing
Type
Boolean

getFriction() → {Number}

Return the Friction
Source:
Returns:
current Friction value
Type
Number

getInvMass() → {Number}

Source:
Returns:
Type
Number

getPosition() → {vec2}

Return the position of object
Source:
Returns:
position of object [X, Y]
Type
vec2

getRestitution() → {Number}

Return the Restitution
Source:
Returns:
current Restitution value
Type
Number

getVelocity() → {vec2}

Get the Velocity of the object
Source:
Returns:
current Velocity [X, Y]
Type
vec2

getXform() → {Transform}

Return the objects Transform
Source:
Returns:
this Transform
Type
Transform

resolveParticleCollision(aParticle) → {Boolean}

pushes a Particle out of a RigidCircle or a RigidRectangle.
Parameters:
Name Type Description
aParticle Particle
Source:
Returns:
Type
Boolean

rigidType() → {enum|eRigidType}

Return the type of Rigidshape
Source:
Returns:
Type
enum | eRigidType

setAcceleration(g) → {void}

Set the Acceleration
Parameters:
Name Type Description
g Array.<Float> new Acceleration [X, Y]
Source:
Returns:
Type
void

setColor(color) → {void}

Set the Color of the position marker
Parameters:
Name Type Description
color Array.<Float> new color of marker [R, G, B, A]
Source:
Returns:
Type
void

setDrawBounds(d) → {void}

Set if bound drawing is active
Parameters:
Name Type Description
d Boolean true if bounds should be drawn
Source:
Returns:
Type
void

setFriction(f) → {void}

Set the Friction
Parameters:
Name Type Description
f Number new Friction value
Source:
Returns:
Type
void

setMass(m) → {void}

Set the mass of the object
Parameters:
Name Type Description
m Number new Mass
Source:
Returns:
Type
void

setPosition(x, ynew) → {void}

Set the position of object
Parameters:
Name Type Description
x Number new X position
ynew Number Y position
Source:
Returns:
Type
void

setRestitution(r) → {void}

Set the Restitution
Parameters:
Name Type Description
r Number new Restitution value
Source:
Returns:
Type
void

setVelocity(v) → {void}

Set the Velocity of the object
Parameters:
Name Type Description
v vec2 new Velocity [X, Y]
Source:
Returns:
Type
void

setXform(xform) → {void}

Set the Transform to this object
Parameters:
Name Type Description
xform Transform new Transform
Source:
Returns:
Type
void

update() → {void}

Update Function called by GameLoop
Source:
Returns:
Type
void