#Recreate applyImpulse for Player

1 messages · Page 1 of 1 (latest)

jagged talon
#
player.setVelocity(Vector.multiply(player.getViewDirection(),5))
#

yeah

#

the vector input would be the direction type of vector, not location vector

#
function setVelocity(vector, strength = 1) {
  const { x, y, z } = Vector.multiply(vector, strength)
  const horizontal = Math.sqrt(x * x + z * z) * 2.0;
  const vertical = y < 0.0 ? 0.5 * y : y;
  this.applyKnockback(x, z, horizontal, vertical);
}
Player.prototype.setVelocity = setVelocity
Entity.prototype.setVelocity = setVelocity
```same, but yk deconstructured XD
#
entity.setVelocity(source.getViewDirection(),3)