Package net.minestom.server.collision
Class PhysicsUtils
java.lang.Object
net.minestom.server.collision.PhysicsUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull PhysicsResult
simulateMovement
(@NotNull Pos entityPosition, @NotNull Vec entityVelocityPerTick, @NotNull BoundingBox entityBoundingBox, @NotNull WorldBorder worldBorder, Block.Getter blockGetter, @NotNull Aerodynamics aerodynamics, boolean entityNoGravity, boolean entityHasPhysics, boolean entityOnGround, boolean entityFlying, @Nullable PhysicsResult previousPhysicsResult) Simulate the entity's movement physics
-
Method Details
-
simulateMovement
@NotNull public static @NotNull PhysicsResult simulateMovement(@NotNull @NotNull Pos entityPosition, @NotNull @NotNull Vec entityVelocityPerTick, @NotNull @NotNull BoundingBox entityBoundingBox, @NotNull @NotNull WorldBorder worldBorder, @NotNull Block.Getter blockGetter, @NotNull @NotNull 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
-