How to move a part in same orientation from your part origin but change his distance?
Should i use lookvector? and how use it?
Could you please be more specific?
Basically i have a ‘target part’ welded with a base part , so when i change base part orientation , target part follow him, but i need a way to change the distance between base part and target part to achieve the red part position
No, i want only the welded part to move far away from base,but in same orientation
So basically you want the part to move X units away from the base at the same orientation
Yes, i tried using lookvector but didnt undestand how to use it, maybe theres another way
Use the Lerp function on the Vector3 or CFrame
You could try
Part2.Position = Part1.Position + (Part1.CFrame.LookVector * Distance)
There are definitely a lot of ways to do this, the easiest one I can think of is this:
local distance = 10
local difference = (a.Position - b.Position).Unit -- difference in distance between the parts, normalized
b.Position = a.Position + (difference * distance) -- move part b to the position of part a offset by difference multiplied by distance
Another way to do this is to just lerp the position
b.Position = a.Position:Lerp(b.Position, value) -- Works great but it would multiply the distance by value instead of setting it
Im sure there are even more ways to achieve what you need though