Velocity and Yaw

Discussion in 'Plugin Development' started by TheTinySpider, Feb 27, 2013.

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

    TheTinySpider

    Hello, Im trying to make it so you can ride a bat.
    I got X and Z velocity working, but i cant get Y to work.
    Any of you good with math and can show me what to put to get Y-asis working?

    PHP:
                        Vector v = new Vector();
                       
                        
    Float dirX = (float) (- (Math.sin((p.getLocation().getYaw() / 180) * Math.PI) * 1));
                        
    Float dirZ = (float) (Math.cos((p.getLocation().getYaw() / 180) * Math.PI) * 1);
                       
                        
    bat.setVelocity(v.setX(dirX));
                        
    bat.setVelocity(v.setZ(dirZ));
     
  2. Offline

    chasechocolate

    I don't know what you want it to look like, but can't you just use bat.setPassenger(player)?
     
  3. Offline

    TheTinySpider

    chasechocolate No, im looking for someone who can figure out:
    Float dirY = (float) (??????); the dirY
     
  4. Offline

    TheTinySpider

  5. Offline

    juampi_92

    TheTinySpider , maybe you could get the Location of the entity that you get the yaw, and use getDirection()
    Or toVector()

    I think that includes the Y.

    Example: player.getLocation().getDirection() (this is a vector) or player.getLocation().toVector()
     
Thread Status:
Not open for further replies.

Share This Page