-
- All Implemented Interfaces:
-
de.chaffic.dynamics.bodies.PhysicalBodyInterface,de.chaffic.geometry.bodies.TranslatableBody
public abstract class AbstractPhysicalBody implements PhysicalBodyInterface
-
-
Field Summary
Fields Modifier and Type Field Description private Vec2velocityprivate Vec2forceprivate DoubleangularVelocityprivate Doubletorqueprivate Doublerestitutionprivate Doubledensityprivate Doublemassprivate DoubleinvMassprivate Doubleinertiaprivate DoubleinvInertiaprivate DoubleangularDampeningprivate DoublelinearDampeningprivate BooleanaffectedByGravityprivate Booleanparticleprivate Vec2position
-
Constructor Summary
Constructors Constructor Description AbstractPhysicalBody()
-
Method Summary
-
-
Method Detail
-
getVelocity
Vec2 getVelocity()
-
setVelocity
Unit setVelocity(Vec2 velocity)
-
getAngularVelocity
Double getAngularVelocity()
-
setAngularVelocity
Unit setAngularVelocity(Double angularVelocity)
-
getRestitution
Double getRestitution()
-
setRestitution
Unit setRestitution(Double restitution)
-
getDensity
Double getDensity()
-
setDensity
Unit setDensity(Double density)
Sets the density and calculates the mass depending on it.
- Parameters:
density- the new value for density.
-
getInvMass
Double getInvMass()
-
setInvMass
Unit setInvMass(Double invMass)
-
getInertia
Double getInertia()
-
setInertia
Unit setInertia(Double inertia)
-
getInvInertia
Double getInvInertia()
-
setInvInertia
Unit setInvInertia(Double invInertia)
-
getAngularDampening
Double getAngularDampening()
-
setAngularDampening
Unit setAngularDampening(Double angularDampening)
-
getLinearDampening
Double getLinearDampening()
-
setLinearDampening
Unit setLinearDampening(Double linearDampening)
-
getAffectedByGravity
Boolean getAffectedByGravity()
-
setAffectedByGravity
Unit setAffectedByGravity(Boolean affectedByGravity)
-
getParticle
Boolean getParticle()
-
setParticle
Unit setParticle(Boolean particle)
-
getPosition
abstract Vec2 getPosition()
-
setPosition
abstract Unit setPosition(Vec2 position)
-
applyForce
Unit applyForce(Vec2 force, Vec2 contactPoint)
Applies force ot body.
- Parameters:
force- Force vector to apply.contactPoint- The point to apply the force to relative to the body in object space.
-
applyForce
Unit applyForce(Vec2 force)
Apply force to the center of mass.
- Parameters:
force- Force vector to apply.
-
applyLinearImpulse
Unit applyLinearImpulse(Vec2 impulse, Vec2 contactPoint)
Applies impulse to a point relative to the body's center of mass.
- Parameters:
impulse- Magnitude of impulse vector.contactPoint- The point to apply the force to relative to the body in object space.
-
applyLinearImpulse
Unit applyLinearImpulse(Vec2 impulse)
Applies impulse to body's center of mass.
- Parameters:
impulse- Magnitude of impulse vector.
-
-
-
-