Reply To: Hit moving target ?

Forum Archive Hit moving target ? Reply To: Hit moving target ?

#37531
Jonathan Gonzalez
Participant

    @aeleas I haven’t tested it, but velocity is a Vector3. If you look at the answer for the first link you’ll see something like this:

    // to leave y-speed as it was:
     rigidbody2D.velocity.y = MOVE_SPEED;
     // or to make object move only to the right:
     rigidbody2D.velocity = Vector2.right * MOVE_SPEED;
     Vector2 predictedPoint = new Vector2(transform.position.x, transfomr.position.y) + rigidbody2D.velocity * Time.deltaTime;