Pushing an entity towards a player

Discussion in 'Plugin Development' started by x2nec, Aug 20, 2012.

Thread Status:
Not open for further replies.
  1. Hey guys, I have this code:

    Code:
    Vector v = t.getLocation().toVector().subtract(p.getLocation().toVector()).setY(0).normalize().multiply(hForce * power).setY(vForce * power);
            t.setVelocity(v);
    The problem is, this pushes the entity in the wrong direction. I want the entity to be pushed towards the player. How can I get this effect (if possible, using what I have above)?
     
Thread Status:
Not open for further replies.

Share This Page