Package io.github.espressoengine.physics
Class RigidBody
java.lang.Object
io.github.espressoengine.physics.RigidBody
RigidBody class.
- Version:
- $Id: $Id
- Author:
- pastthepixels
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled byPhysicsEnginewhen it callsnextFrame.voidChecks collisions with another object and updates its velocity accordingly.voidcheckScreenCollisions(Vector2 bounds) Checks collisions with the edges of the screen and updates the velocity of the object accordingly.voidonBodyEntered(RigidBody body) Called when the body enters another body.voidonBodyExited(RigidBody body) Called when the body exits another body.voidUpdates the position of an object with its velocity.
-
Field Details
-
object
-
velocity
-
mass
public double mass -
disabled
public boolean disabled -
collidingBodies
-
oldCollidingBodies
-
dbg
public boolean dbg
-
-
Constructor Details
-
RigidBody
Constructor for RigidBody.
- Parameters:
object- aObjectobject
-
-
Method Details
-
setPosition
public void setPosition()Updates the position of an object with its velocity.
-
checkScreenCollisions
Checks collisions with the edges of the screen and updates the velocity of the object accordingly.- Parameters:
bounds- aVector2object
-
checkObjectCollisions
Checks collisions with another object and updates its velocity accordingly.- Parameters:
body- aRigidBodyobject
-
_onUpdate
public void _onUpdate()Called byPhysicsEnginewhen it callsnextFrame. OverrideonUpdateinstead of this function. -
onBodyEntered
Called when the body enters another body. Designed to be overridden.- Parameters:
body- aRigidBodyobject
-
onBodyExited
Called when the body exits another body. Designed to be overridden.- Parameters:
body- aRigidBodyobject
-