java.lang.Object
net.minestom.server.collision.PhysicsUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic PhysicsResult
simulateMovement
(Pos entityPosition, Vec entityVelocityPerTick, BoundingBox entityBoundingBox, WorldBorder worldBorder, Block.Getter blockGetter, Aerodynamics aerodynamics, boolean entityNoGravity, boolean entityHasPhysics, boolean entityOnGround, boolean entityFlying, @Nullable PhysicsResult previousPhysicsResult) Simulate the entity's movement physics
-
Method Details
-
simulateMovement
public static PhysicsResult simulateMovement(Pos entityPosition, Vec entityVelocityPerTick, BoundingBox entityBoundingBox, WorldBorder worldBorder, Block.Getter blockGetter, Aerodynamics aerodynamics, boolean entityNoGravity, boolean entityHasPhysics, boolean entityOnGround, boolean entityFlying, @Nullable @Nullable PhysicsResult previousPhysicsResult) Simulate the entity's movement physicsThis is done by first attempting to move the entity forward with the current velocity passed in. Then adjusting the velocity by applying air resistance and friction.
- Parameters:
entityPosition
- the current entity positionentityVelocityPerTick
- the current entity velocity in blocks/tickentityBoundingBox
- the current entity bounding boxworldBorder
- the world border to test bounds againstblockGetter
- the block getter to test block collisions againstaerodynamics
- the current entity aerodynamicsentityNoGravity
- whether the entity has gravityentityHasPhysics
- whether the entity has physicsentityOnGround
- whether the entity is on the groundentityFlying
- whether the entity is flyingpreviousPhysicsResult
- the physics result from the previous simulation or null- Returns:
- a
PhysicsResult
containing the resulting physics state of this simulation
-