Class GravityField
Extends
JEffect.
GravityField a gravity field effect
This effect has a radius within which it will either attract or repel bodies depending on the defined force
(positive values attract, negative repel) and their distance (the closer the object, the stronger the effect).
This effect will be applied continuously as long as it is enabled
This effect can either be placed at an arbitrary location in the scene, or it can be attached to a parent object.
Defined in: gravityField.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GravityField(location, _radius, _force, _parent)
|
| Field Attributes | Field Name and Description |
|---|---|
|
the force of the effect at 0 distance (impulse will be force/distance)
|
|
|
initial location of the effect expressed as a 3D vector
|
|
|
optional - a RigidBody that the gravitational field will follow - excluded from effect
|
|
|
radius of effect - the distance at which the effect's influence will drop to zero
|
- Fields borrowed from class :
- JEffect#_effectEnabled
| Method Attributes | Method Name and Description |
|---|---|
|
Apply()
|
Class Detail
GravityField(location, _radius, _force, _parent)
Author: Jim Sangwine.
- Parameters:
- {array} location
- initial location of the effect expressed as a 3D vector
- {number} _radius
- radius of effect - the distance at which the effect's influence will drop to zero
- {number} _force
- the force of the effect at 0 distance (impulse will be force/distance)
- {RigidBody} _parent
- optional - a RigidBody that the gravitational field will follow - excluded from effect
- Requires:
- Vector3DUtil
Field Detail
{number}
force
the force of the effect at 0 distance (impulse will be force/distance)
{array}
location
initial location of the effect expressed as a 3D vector
{RigidBody}
parent
optional - a RigidBody that the gravitational field will follow - excluded from effect
{number}
radius
radius of effect - the distance at which the effect's influence will drop to zero
Method Detail
{void}
Apply()
- See:
- JEffect.Apply