Hey guys. Never took Calculus 2. Struggling with Vector math. I just need to…
You can use the direction vector going from rocket origin to target. Target position - rocket origin position.
Then get that unitized to length 1.
Multiply that by 20 units.
Add that to the target position to get the position behind the target.
Wrote in my phone.
You can get the direction the missile travels by getting the unit vector of the difference between the two positions. Unit vectors are one unit long:
local direction = (Character.Position - RocketOrigin.Position).Unit
You can get the distance it should travel by getting the distance to the character, plus 20:
local distance = (Character.Position - RocketOrigin.Position).Magnitude + 20
You can get the destination by adding the direction * distance added on to the origin position
local destination = RocketOrigin.Position + direction * distance
Perfect Thank you. I knew I had the necessary data, but just not the algorithm.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.