Velocity and Ice

Discussion in 'Plugin Development' started by Energisse, Sep 23, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Energisse

    I'm trying to edit the velocity of a boat while moving on ice with a player but i have two problems:
    1. The function getVelocity() returns 0.0,0.0,0.0 from the boat and the player on ice my solution for this is that (i don't know if it's perfect but it works)
      Code:
      public void onMove(PlayerMoveEvent e) {
          double vx = e.getTo().getX() - e.getFrom().getX();
          double vz = e.getTo().getZ() - e.getFrom().getZ();
      }
    2. When I edit the boat's velocity sometimes the boat stop for no reason, i don't know why.
      Code:
      boat.setVelocity(new Vector( 2D*boat.getLocation().getDirection().getX() , 0D, 2D*boat.getLocation().getDirection().getZ()));
    If you can help me.
     
  2. Offline

    Tim_M

    Last edited: Oct 10, 2021
Thread Status:
Not open for further replies.

Share This Page