Skip to main content

Characterbody

class Characterbody

Characterbody is a specialized physics type for characters as it allows a lot of configuration and takes some bad points from Rigidbody.


public class Characterbody
extends PhysicsEntity

— Constructors (1) —

ConstructorDescription
Characterbody()Creates a new Characterbody.

— Methods (28) —

NameDescription
boolean isGravityEnabled()Returns if the object gravity is enabled.
void setGravityEnabled(boolean enabled)Sets the object gravity state, enabled or disabled to be "enabled" argument.
Vector3 getGravityMultiplier()Returns the gravity value of the object.
void setGravityMultiplier(Vector3 vector)Sets the object's severity value to be "vector" argument.
boolean isGlobalDirections()Returns if the movement axis is the world axis, not the object axis.
void setGlobalDirections(boolean enabled)Sets wich will be the movement axis to be "enabled" argument, if enabled is true, the movement axis will be the world axis, else, the movement axis will be the object axis.
boolean isGrounded()Returns if the object dont jumped and is colliding with the ground.
boolean onGround()Returns if the object is on ground.
boolean canJump()Returns if the object can or not jump.
void jump()Makes the object jump.
void setSpeed(float x, float z)Sets the object speed to be "x", "y" and "z" arguments.
float getForwardSpeed()Returns the object speed in Z axis.
void setForwardSpeed(float value)Sets the object speed in Z axis to be "value" argument.
float getSideSpeed()Returns the object speed in X axis.
void setSideSpeed(float value)Sets the object speed in X axis to be "value" argument.
void zeroSpeed()Sets the object speed with 0 in both axis.
float getHeight()Returns the object height, not the object scale in Y axis.
void setHeight(float value)Sets the object height to be "value" argument, not the object scale in Y axis.
float getWidth()Returns the object width, not the object scale in X axis.
void setWidth(float value)Sets the object width to be "value" argument, not the object scale in X axis.
float getJumpSpeed()Returns the object jump speed.
void setJumpSpeed(float value)Sets the object jump speed to be "value" argument.
float getStepHeight()Returns the minimum height to climb on top of objects.
void setStepHeight(float value)Sets the minimum height to climb in top of objects to be "value" argument.
Vector3 getPhysicsVelocity()Returns all the forces that are being applied to the object in just one Vector3.
Vector2 getHorizontalPhysicsVelocity()Returns all the forces that are being applied excluding the Y axis in a Vector2.
[JAVARuntime.PhysicsLayer] getPhysicsLayer()Returns the PhysicsLayer of the Characterbody component.
void setPhysicsLayer([PhysicsLayer] layer)Sets the PhysicsLayer of the Characterbody component to be "layer" argument.

— Inherited Methods (7) —

NameDescription
SpatialObject getObject()Returns the current SpatialObject component.
String getTittle()Returns the current name of the component.
boolean colliderWithName(String objectName)Checks if the current object is colliding with the object whose name is defined to be "name" argument.
boolean isColliding()Returns if the actual object is colliding with any object.
List\<Collision> getCollisionList()Returns a List\<Collision> with all collisions informations that are ocurring with the actual object.
Collision getCollisionAt(int idx)Returns a Collision class with all informations about the collision information with index == idx in getCollisionList method return value.
int getCollisionsCount()Returns the number of collisions.