Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

rotation between two positions?

Is there any way to get a rotation between two positions

for example:

part points in direction of position2 from position1

Thanks

Exsius :)

1 comment

0

use lerp

2 answers

✓ Accepted answer

Yes this is possible just read up the wiki, i'll post the link and an example

CFrame Guide

part.CFrame = CFrame.new(part.Position, Vector3.new(0,0,0)) -- this will point at 0,0,0 but still remain at the parts original position

1 comment

0

Thank you for your help! I truly appreciate it.

devSeldom's awnser is a way but there is another way you can use with CFrame.

The other way use a method from CFrame called Lerp this method use two parametre CFrame:lerp(CFrame goal, number alpha) So you'll need to use this like that

local part = workspace.Part
for i = 0, 1, 0.1 do
	wait(0.1)
	part.CFrame = part.CFrame:lerp(CFrame.new(5, 3, 1) * CFrame.Angles(math.pi / 2, math.pi / 2, 0), i)
end

Now you can run it and look at the part, You'll see his mouvement. Hope this help you.

This discussion is preserved as it was. New answers, comments, and votes are closed.