Package org.alban098.physics2j
Class PhysicsComponent
java.lang.Object
org.alban098.common.Component
org.alban098.physics2j.PhysicsComponent
public class PhysicsComponent
extends org.alban098.common.Component
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyForce
(Force force, org.joml.Vector2f offset) void
applyTorque
(float torque) void
void
org.joml.Vector2f
float
float
org.joml.Vector2f
org.joml.Vector2f
getDrag()
float
getMass()
float
org.joml.Vector2f
boolean
void
void
setAcceleration
(float x, float y) void
setAngularAcceleration
(float angularAcceleration) void
setAngularVelocity
(float angularVelocity) void
setDrag
(float drag) void
setDrag
(float x, float y) void
setDrag
(org.joml.Vector2f drag) void
setMass
(float mass) void
setVelocity
(float x, float y) void
update
(double deltaTime) Methods inherited from class org.alban098.common.Component
equals, hashCode
-
Field Details
-
forces
-
drag
private final org.joml.Vector2f drag -
torque
-
velocity
private final org.joml.Vector2f velocity -
acceleration
private final org.joml.Vector2f acceleration -
angularVelocity
private float angularVelocity -
angularAcceleration
private float angularAcceleration -
mass
private float mass -
hitbox
-
-
Constructor Details
-
PhysicsComponent
public PhysicsComponent(float mass, org.joml.Vector2f scale)
-
-
Method Details
-
update
public void update(double deltaTime) -
resolveForces
public void resolveForces() -
applyForce
-
applyTorque
public void applyTorque(float torque) -
clearForces
public void clearForces() -
clearTorques
public void clearTorques() -
getVelocity
public org.joml.Vector2f getVelocity() -
setVelocity
public void setVelocity(float x, float y) -
getAcceleration
public org.joml.Vector2f getAcceleration() -
setAcceleration
public void setAcceleration(float x, float y) -
getAngularVelocity
public float getAngularVelocity() -
setAngularVelocity
public void setAngularVelocity(float angularVelocity) -
getAngularAcceleration
public float getAngularAcceleration() -
setAngularAcceleration
public void setAngularAcceleration(float angularAcceleration) -
getMass
public float getMass() -
setMass
public void setMass(float mass) -
getHitbox
-
getCenterOfMass
public org.joml.Vector2f getCenterOfMass() -
getMomentOfInertia
public float getMomentOfInertia() -
isSubjectToStaticForces
public boolean isSubjectToStaticForces() -
getDrag
public org.joml.Vector2f getDrag() -
setDrag
public void setDrag(org.joml.Vector2f drag) -
setDrag
public void setDrag(float x, float y) -
setDrag
public void setDrag(float drag)
-