Hi,

I have two Vector3 positions, one is the position of the player, the other is the position of the mouse in the 3D world. I am spawning a bullet at the player position and then Lerp-ing it to the mouse position which works fine.

I want to make the bullet go beyond the mouse position, somehow add length to the vector.

This is how I'm moving the bullet now:
this.Position = this.Position.Lerp(this.bullet_directon, 0.09f);

  • xyz replied to this.
  • TsenoTsenov If you have a line segment going from endpoint A to endpoint B, to extend the endpoint B along its direction for some distance d to a new endpoint B1:

    • calculate the normalized direction vector AB by subtracting B from A and normalizing it.
    • multiply this direction vector by the distance d and add it to B.

    TsenoTsenov If you have a line segment going from endpoint A to endpoint B, to extend the endpoint B along its direction for some distance d to a new endpoint B1:

    • calculate the normalized direction vector AB by subtracting B from A and normalizing it.
    • multiply this direction vector by the distance d and add it to B.