mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-27 14:13:24 +02:00
Changed gravity calculation
This commit is contained in:
parent
e66fc2d200
commit
adf0e06888
@ -529,9 +529,7 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
|||||||
Vector newVelocityOut = new Vector();
|
Vector newVelocityOut = new Vector();
|
||||||
|
|
||||||
// Gravity force
|
// Gravity force
|
||||||
final double gravityY = !hasNoGravity() ? Math.min(
|
final double gravityY = hasNoGravity() ? 0 : gravityAcceleration;
|
||||||
gravityDragPerTick + (gravityAcceleration * (double) gravityTickCount),
|
|
||||||
gravityTerminalVelocity) : 0;
|
|
||||||
|
|
||||||
final Vector deltaPos = new Vector(
|
final Vector deltaPos = new Vector(
|
||||||
getVelocity().getX() / tps,
|
getVelocity().getX() / tps,
|
||||||
@ -596,6 +594,8 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
|||||||
|
|
||||||
this.velocity.setX(velocity.getX() * drag);
|
this.velocity.setX(velocity.getX() * drag);
|
||||||
this.velocity.setZ(velocity.getZ() * drag);
|
this.velocity.setZ(velocity.getZ() * drag);
|
||||||
|
if (!hasNoGravity())
|
||||||
|
this.velocity.setY(velocity.getY() * (1-gravityDragPerTick));
|
||||||
|
|
||||||
if (velocity.equals(new Vector())) {
|
if (velocity.equals(new Vector())) {
|
||||||
this.velocity.zero();
|
this.velocity.zero();
|
||||||
|
Loading…
Reference in New Issue
Block a user