Class PhysicsUtils

java.lang.Object
net.minestom.server.collision.PhysicsUtils

public final class PhysicsUtils extends Object
  • 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 physics

      This 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 position
      entityVelocityPerTick - the current entity velocity in blocks/tick
      entityBoundingBox - the current entity bounding box
      worldBorder - the world border to test bounds against
      blockGetter - the block getter to test block collisions against
      aerodynamics - the current entity aerodynamics
      entityNoGravity - whether the entity has gravity
      entityHasPhysics - whether the entity has physics
      entityOnGround - whether the entity is on the ground
      entityFlying - whether the entity is flying
      previousPhysicsResult - the physics result from the previous simulation or null
      Returns:
      a PhysicsResult containing the resulting physics state of this simulation