GroundedMovement Class
A component class which allows an entity to move horizontally while on the ground or in the air.
Constructor
GroundedMovement
-
groundMovementImpulseMagnitude
-
airMovementImpulseMagnitude
-
groundSpeedLimit
-
airSpeedLimit
-
onGroundTime
-
idleFriction
Parameters:
-
groundMovementImpulseMagnitude
NumberThe magnitude of an impulse that will be applied to move an entity while it's on the ground.
-
airMovementImpulseMagnitude
NumberThe magnitude of an impulse that will be applied to move an entity while it's in the air.
-
groundSpeedLimit
NumberMaximum velocity on the x axis that the entity can achieve while on the ground.
-
airSpeedLimit
NumberMaximum velocity on the x axis that the entity can achieve while in the air.
-
onGroundTime
NumberThis is the time, in seconds, that the entity remains on ground after it physically is no longer touching the ground. This, for example, gives a time window for an entity to jump after it left the ground by running off of a platform.
-
idleFriction
NumberEach entity that has this component will have its friction set to 0 to ensure smooth movement. Entity's friction will be set to this value when its trying to stop while on the ground or while it's standing idly.
Item Index
Methods
- getAirMovementImpulseMagnitude
- getAirSpeedLimit
- getGroundMovementImpulseMagnitude
- getGroundRightTangent
- getGroundSpeedLimit
- getIdleFriction
- getOnGroundTime
- isOnGround
- setAirMovementImpulseMagnitude
- setAirSpeedLimit
- setGroundMovementImpulseMagnitude
- setGroundSpeedLimit
- setIdleFriction
- setOnGroundTime
Methods
getAirMovementImpulseMagnitude
()
Number
Returns:
getAirSpeedLimit
()
Number
Returns:
getGroundMovementImpulseMagnitude
()
Number
Returns:
getGroundRightTangent
-
vector
Returns a normalized vector that goes along the ground surface this entity was last standing on, pointing to the right.
Parameters:
-
vector
Vector2DVector to which the tangent will be copied.
getGroundSpeedLimit
()
Number
Returns:
getIdleFriction
()
Number
Returns:
getOnGroundTime
()
Number
Returns:
isOnGround
()
Number
Returns:
setAirMovementImpulseMagnitude
-
airMovementImpulseMagnitude
Parameters:
-
airMovementImpulseMagnitude
NumberThe magnitude of an impulse that will be applied to move an entity while it's in the air.
setAirSpeedLimit
-
airSpeedLimit
Parameters:
-
airSpeedLimit
NumberMaximum velocity on the x axis that the entity can achieve while in the air.
setGroundMovementImpulseMagnitude
-
groundMovementImpulseMagnitude
Parameters:
-
groundMovementImpulseMagnitude
NumberThe magnitude of an impulse that will be applied to move an entity while it's on the ground.
setGroundSpeedLimit
-
groundSpeedLimit
Parameters:
-
groundSpeedLimit
NumberMaximum velocity on the x axis that the entity can achieve while on the ground.
setIdleFriction
-
idleFriction
Parameters:
-
idleFriction
NumberEach entity that has this component will have its friction set to 0 to ensure smooth movement. Entity's friction will be set to this value when its trying to stop while on the ground or while it's standing idly.
setOnGroundTime
-
onGroundTime
Parameters:
-
onGroundTime
NumberThis is the time, in seconds, that the entity remains on ground after it physically is no longer touching the ground. This, for example, gives a time window for an entity to jump after it left the ground by running off of a platform.