new RigidShape(xf)
Default Constructor
A shape attached to a transform to allow for Collision Handling
Parameters:
Name | Type | Description |
---|---|---|
xf |
Transform | The transform that the RigidShape will be based off of |
- Source:
Methods
adjustPositionBy(v, delta)
Adjusts the position of the rigid body by the parameters
Parameters:
Name | Type | Description |
---|---|---|
v |
float | |
delta |
float |
- Source:
boundTest(otherShape) → {Boolean}
Checks to see if this shape and the passed shape are overlapping
Parameters:
Name | Type | Description |
---|---|---|
otherShape |
RigidShape | The shape being checked for overlapping |
- Source:
Returns:
Whether the shapes overlap or not
- Type
- Boolean
draw(aCamera)
Draws the bounds of the Rigid Shape
Parameters:
Name | Type | Description |
---|---|---|
aCamera |
Camera | The camera to draw the shape on |
- Source:
drawCircle(aCamera, r)
Draws the bounds of the Rigid Circle
Parameters:
Name | Type | Description |
---|---|---|
aCamera |
Camera | The camera to draw the shape on |
r |
float | The radius of the circle |
- Source:
flipVelocity()
Inverses both the x and y velocity
- Source:
getAngularVelocity() → {float}
Return mAngularVelocity
- Source:
Returns:
AngularVelocity
- Type
- float
getBoundRadius() → {float}
Return the bound radius
- Source:
Returns:
mBoundRadius
- Type
- float
getCenter() → {Array.<Float>}
Return the center of the Rigid Body
- Source:
Returns:
Center Position [x,y]
- Type
- Array.<Float>
getCurrentState() → {String}
Gets the mass, inertia, friction, restitution of the shape and returns it as a string
- Source:
Returns:
A string containing the physic values of the rigid shape
- Type
- String
getFriction() → {float}
Return mFriction
- Source:
Returns:
mFriction
- Type
- float
getInertia() → {float}
Return mInertia
- Source:
Returns:
mInertia
- Type
- float
getInvMass() → {float}
Return mInvMass
- Source:
Returns:
mInvMass
- Type
- float
getRestitution() → {float}
Return mRestitution
- Source:
Returns:
mRestitution
- Type
- float
getType() → {String}
Get the type of shape it is
- Source:
Returns:
The type of shape
- Type
- String
getVelocity() → {Array.<float>}
Returns the velocity of the rigid shape
- Source:
Returns:
The velocity [xVelocity, yVelocity]
- Type
- Array.<float>
resolveParticleCollision(aParticle, xf) → {boolean}
Handles collision between
Parameters:
Name | Type | Description |
---|---|---|
aParticle |
Particle | The particle to check for collisison |
xf |
Transform | The transform of the particle |
- Source:
Returns:
status, Whether the rigid shape collided with a particle
- Type
- boolean
setAngularVelocity(w)
Sets the Angular Velocity of the rigid body
Parameters:
Name | Type | Description |
---|---|---|
w |
float | The number to set the Angular Velocity to |
- Source:
setAngularVelocityDelta(dw)
Sets the Angular Velocity delta of the rigid body
Parameters:
Name | Type | Description |
---|---|---|
dw |
float | The number to set the Angular Velocity Delta to |
- Source:
setBoundRadius(r)
Set the radius of the bound
Parameters:
Name | Type | Description |
---|---|---|
r |
float | The number to set the radius |
- Source:
setFriction(f)
Sets the Inertia of the rigid body
Parameters:
Name | Type | Description |
---|---|---|
f |
float | The number to set the Inertia to |
- Source:
setInertia(i)
Sets the Inertia of the rigid body
Parameters:
Name | Type | Description |
---|---|---|
i |
float | The number to set the Inertia to |
- Source:
setMass(m)
Sets the mass of the rigid body. Used for physics calculations
Parameters:
Name | Type | Description |
---|---|---|
m |
float | The number to set the mass to |
- Source:
setRestitution(r)
Sets the Restitution of the rigid body
Parameters:
Name | Type | Description |
---|---|---|
r |
float | The number to set the Restitution to |
- Source:
setTransform(xf)
Return's the transform of the RigigdShape
Parameters:
Name | Type | Description |
---|---|---|
xf |
Transform | The transfomrm that you want to set the shape to |
- Source:
setVelocity(x, y)
Sets the velocity of the rigid shape
Parameters:
Name | Type | Description |
---|---|---|
x |
float | The number to set the xVelocity to |
y |
float | The number to set the yVelocity to |
- Source:
toggleDrawBound()
Toggle the drawing of the rigidbody
- Source:
travel()
Handles the motion of the rigid shape
- Source:
update()
Updates the RigidShape
- Source:
userSetsState()
Allows for keyboard controls to manipulate the shape
- Source: