Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Mupp on February 24, 2021, 07:06:58 PM
-
How can I get an objects relative position if it's the middle object of 3 objects in a line? I want this value as a float so I can use it as the amount in a LERP action.
-
Relative to what, World space?
And position is either Vector2 or Vector3 / X, Y, Z , which variable is the float going to affect?
-
Um, what's unclear exactly? Have you never used a LERP action? You have 2 points and you move a 3rd between then using a float as its relative position between them.
-
break it down into steps (I see 3 steps)
1. get the difference (actual distance) between start A and end B objects
*probably difference=Abs(B-A)
2. get the difference between the middle object Mid from the start A
*probably midDifference=Abs(Mid-A)
3. divide the 2nd result by the 1st
*probably T=midDifference/difference
T gives you the value to set the Lerp.
-
I don't know what you mean by "probably", but thanks. I'll give this a try.