- Home /

# Determining location of intersection from position, rotation, rotation speed, and forward speed of objects.

I have one gameObject that moves, and a projectile missile that is meant to collide with it.

My current setup has my missile targeting the position of the target, and not where it will be (which would be most efficient). I know the position of both objects, and the speed as a vector3 (so i can have the x and y components easily). I calculate this speed every frame by subtracting where it was previous frame for where it is now (and subtracting the vector3's).

I know i want to determine the distance between both objects, and then subtract the speeds of both objects to find a net speed difference. Then i use this and divide this into the distance to find how long it will take to cover this distance. I then add the time needed to rotate towards the target. I then extrapolate the position the target will be at during that time. (and make adjustments for targeting this position).

Is this a good general approach? I notice that if i try to determine the position from the time it takes, i will be off because the distance and time was calculated by covering the previous distance. What if the distance changed by extrapolating a new position? Wouldn't i just calculate a position over and over?

How do a determine a delta position without knowing position functions, when given the rotation, the rotation speed, the position, and the forward speed of each object.

"Wouldn't i just calculate a position over and over?"

Yes, but it very rapidly converges. In other words, your 2nd position might by 0.5 away from the 1st. Then your 3rd position will be 0.1 away, then the 4th only 0.01 away.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.