Skip to main content

Rigidbody

class Rigidbody

Rigidbody is a physics type that can be used on objects, this type adds vector forces, for example gravity, and allows you to add vector forces. This physics does not allow objects to traverse other objects that have different physics than the AreaTrigger and ForceField.


public class Rigidbody
extends PhysicsEntity

— Constructors (1) —

ConstructorDescription
Rigidbody()Creates a new Rigidbody.

— Methods (29) —

NameDescription
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.
boolean isGravityEnabled()Returns the gravity state, enabled or disabled.
void setGravityEnabled(boolean enabled)Sets the object gravity state, enabled or disabled to be "enabled" argument.
float getMass()Returns the object mass.
void setMass(float value)Sets the object mass to be "value" argument.
float getFriction()Returns the object friction value.
void setFriction(float value)Sets the object friction value to be "value" argument.
float getLinearDamping()Returns the object linear damping.
void setLinearDamping(float value)Sets the object linear damping to be "value" argument.
float getAngularDamping()Returns the object angular dampung.
void setAngularDamping(float value)Sets the object angular damping to be "value" argument.
void addForce(Vector3 value)Add force to the object according to the global axis in each frame to be "vector3" arguments.
void addForce(float x, float) y, float z)Add force to the object according to the global axis in each frame to be "x", "y" and "z" arguments.
void addForceBySecond(Vector3 value)Add force to the object according to the global axis in each second to be "vector3" arguments.
void addForceBySecond(float x, float y, float z)Add force to the object according to the global axis in each second to be "x", "y" and "z" arguments.
void addVelocity(Vector3 value)Add velocity to the object according to the global axis in each frame to be "vector3" arguments.
void addVelocity(float x, float y, float z)Add velocity to the object according to the global axis in each frame to be "x", "y" and "z" arguments.
void addVelocityBySecond(Vector3 value)Add velocity to the object according to the global axis in each second to be "vector3" argument.
void addVelocityBySecond(float x, float y, float z)Add velocity to the object according to the global axis in each second to be "x", "y" and "z" arguments.
Vector3 getVelocity()Returns the actual object velocity.
void setVelocity(Vector3 value)Sets the objetct velocity to be "vector3" argument.
[PhysicsLayer] getPhysicsLayer()Returns the PhysicsLayer of the Rigidbody component.
void setPhysicsLayer([PhysicsLayer] layer)Defines the PhysicsLayer of the Rigidbody component to be "physicsLayer" argument.
Vector3 getGravityMultiplier()Returns the gravity value of the object.
void setGravityMultiplier(Vector3 vector)Sets the object's severity value to be "vector" 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.