Contents
Class PhysicsBodyStateUpdater
java.lang.Object
com.hypixel.hytale.server.core.modules.physics.util.PhysicsBodyStateUpdater
- Direct Known Subclasses:
PhysicsBodyStateUpdaterMidpoint, PhysicsBodyStateUpdaterRK4, PhysicsBodyStateUpdaterSymplecticEuler
Base class for updating position and velocity of a physics body over time step.
The updater numerically integrates applied forces over the time step to derive acceleration used to compute new position and velocity.
This implementation uses explicit Euler method for integration and is O(dt). See https://en.wikipedia.org/wiki/Euler_method.
- Since:
- 2020-03-06
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidupdate(PhysicsBodyState before, PhysicsBodyState after, double mass, double dt, boolean onGround, ForceProvider[] forceProvider) Compute new position and velocity for a body over a time interval.
-
Constructor Details
-
PhysicsBodyStateUpdater
public PhysicsBodyStateUpdater()
-
-
Method Details
-
update
public void update(@Nonnull PhysicsBodyState before, @Nonnull PhysicsBodyState after, double mass, double dt, boolean onGround, @Nonnull ForceProvider[] forceProvider) Compute new position and velocity for a body over a time interval.- Parameters:
before- Provided position and velocity at start of intervalafter- Resulting position and velocity at end of intervalmass- Mass of bodydt- Time step/intervalonGround- Whether body is on groundforceProvider- Array of force provider used to compute forces applied to body
-