Class twodee.Physics
A physics model.
Defined in: Physics.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a new physics model.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
twodee.Physics.counter
Instance counter.
|
Method Attributes | Method Name and Description |
---|---|
Returns the acceleration vector.
|
|
getDecay()
Returns the decay time in seconds.
|
|
Returns the lifetime in seconds.
|
|
Returns the maximum spin in anti-clockwise RAD per second.
|
|
Returns the maximum velocity in units per second.
|
|
Returns the minimum spin in anti-clockwise RAD per second.
|
|
Returns the minimum velocity in units per second.
|
|
Returns the scaling in multitudes per second.
|
|
getSpin()
Returns the spin in anti-clockwise RAD per second.
|
|
Returns the spin acceleration in anti-clockwise RAD per square second.
|
|
Returns the velocity vector.
|
|
process(node, delta)
Processes the physics model for the specified node and time delta.
|
|
setDecay(decay)
Sets the decay time in seconds.
|
|
setLifetime(lifetime)
Sets the lifetime in seconds.
|
|
setMaxSpin(maxSpin)
Sets the maximum spin in anti-clockwise RAD per second.
|
|
setMaxVelocity(maxVelocity)
Sets the maximum velocity in units per second.
|
|
setMinSpin(minSpin)
Sets the minimum spin in anti-clockwise RAD per second.
|
|
setMinVelocity(minVelocity)
Sets the minimum velocity in units per second.
|
|
setScaling(scaling)
Sets the scaling in multitudes per second.
|
|
setSpin(spin)
Sets the spin in anti-clockwise RAD per second.
|
|
setSpinAcceleration(spinAcceleration)
Sets the spin acceleration in anti-clockwise RAD per square second.
|
Field Detail
<static>
twodee.Physics.counter
Instance counter.
Method Detail
{twodee.Vector}
getAcceleration()
Returns the acceleration vector. The length is units per square second.
There is no setter because you should modify the returned vector instead.
- Returns:
- {twodee.Vector} The acceleration vector. Never null
{number}
getDecay()
Returns the decay time in seconds.
- Returns:
- {number} The decay time in seconds
{number}
getLifetime()
Returns the lifetime in seconds. May return Infinity.
- Returns:
- {number} The lifetime
{number}
getMaxSpin()
Returns the maximum spin in anti-clockwise RAD per second.
- Returns:
- {number} The maximum spin
{number}
getMaxVelocity()
Returns the maximum velocity in units per second.
- Returns:
- {number} The maximum velocity
{number}
getMinSpin()
Returns the minimum spin in anti-clockwise RAD per second.
- Returns:
- {number} The minimum spin
{number}
getMinVelocity()
Returns the minimum velocity in units per second.
- Returns:
- {number} The minimum velocity
{number}
getScaling()
Returns the scaling in multitudes per second.
- Returns:
- {number} The current scaling
{number}
getSpin()
Returns the spin in anti-clockwise RAD per second.
- Returns:
- {number} The current spin
{number}
getSpinAcceleration()
Returns the spin acceleration in anti-clockwise RAD per square second.
- Returns:
- {number} The current spin acceleration
{twodee.Vector}
getVelocity()
Returns the velocity vector. The length is units per second. There is no setter
because you should modify the returned vector instead.
- Returns:
- {twodee.Vector} The velocity vector. Never null
process(node, delta)
Processes the physics model for the specified node and time delta.
- Parameters:
- {twodee.SceneNode} node
- The scene node to update
- {number} delta
- The time delta
{twodee.Physics}
setDecay(decay)
Sets the decay time in seconds. Default value is 1 second. Decay only
makes sense when a life time has been set. Example: Set lifetime to 10
seconds and decay to 2 seconds. The scene node will start fading away
(Decreasing the opacity) at 8 seconds and will be invisible and then
removed at 10 seconds.
- Parameters:
- {number} decay
- The decay time in seconds
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setLifetime(lifetime)
Sets the lifetime in seconds. Default value is Infinity.
- Parameters:
- {number} lifetime
- The lifetime to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setMaxSpin(maxSpin)
Sets the maximum spin in anti-clockwise RAD per second.
- Parameters:
- {number} maxSpin
- The maximum spin to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setMaxVelocity(maxVelocity)
Sets the maximum velocity in units per second.
- Parameters:
- {number} maxVelocity
- The maximum velocity to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setMinSpin(minSpin)
Sets the minimum spin in anti-clockwise RAD per second.
- Parameters:
- {number} minSpin
- The minimum spin to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setMinVelocity(minVelocity)
Sets the minimum velocity in units per second.
- Parameters:
- {number} minVelocity
- The minimum velocity to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setScaling(scaling)
Sets the scaling in multitudes per second.
- Parameters:
- {number} scaling
- The scaling to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setSpin(spin)
Sets the spin in anti-clockwise RAD per second.
- Parameters:
- {number} spin
- The spin to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.
{twodee.Physics}
setSpinAcceleration(spinAcceleration)
Sets the spin acceleration in anti-clockwise RAD per square second.
- Parameters:
- {number} spinAcceleration
- The spin acceleration to set
- Returns:
- {twodee.Physics} This physics instance for method chaining.