of     1   

Eqicness
#228242484Thursday, November 30, 2017 12:10 AM GMT

Hi, So as the title says, I'm trying to figure out relative positioning & relative velocity. I'm having a hard time though. How would I find 5 studs in front of a part, and how would I set a velocity/force to 5 studs in front of the part? Thanks, Eqic
ExtremeBuilder15
#228243999Thursday, November 30, 2017 12:47 AM GMT

What a coincidence, I was just doing something like this. To find a position 5 studs in front of a part is simple enough. You can multiply the lookVector of a CFrame by 5 to get a vector in the same direction as the lookVector, but with a magnitude of 5 rather than 1 (lookVector is a unit). After that, just add it to the CFrame of the original part's CFrame to get a position 5 studs in front of the part. local baseCF = part1.CFrame local inFront = baseCF + (baseCF.lookVector * 5) part2.CFrame = inFront #### puts the second part exactly 5 studs in front of the center position of your part1, but if part1 has a large size and part2 is small, part2 won't be visible because it will be inside of your part1. To correct for this, you can add half of the z Size to the number of studs we want to have the part2 away from part1 local inFront = baseCF + (baseCF.lookVector * (5 + part1.Size.Z/2)) Getting a Vector for velocity is similar, but we only have to worry about positions, not rotation. local baseCF = part1.CFrame local vel = baseCF.lookVector * 5 bodyVelocity.Velocity = vel To have the velocity constantly be 5 studs in front, just put it into a loop. That way if the rotation of the part changes your velocity will correct for that. while true do local baseCF = part1.CFrame local vel = baseCF.lookVector * 5 bodyVelocity.Velocity = vel wait() end
Eqicness
#228245483Thursday, November 30, 2017 1:28 AM GMT

Thank you so much! I never knew lookVector was a unit, that makes a lot of things easier!

    of     1