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

How can I use the rotation values for CFrames?

I'm using this piece of code PartA.CFrame:toObjectSpace(PartB.CFrame)

to find the distance between the rotations of two different CFrames, which returns something along the lines of this

0, 0, 0, 0.907088459, 0.000253136997, 0.420940012, 0, 0.999999762, -0.00060136104, -0.420940131, 0.000545487681, 0.907088339

So this makes sense because the first 3 numbers are the position, and the following numbers are the distance between the rotations, correct? So I just need to know how to add those distances to a CFrame.

1 answer

Why not just use the .Rotation Property of an object? Say

PartA.Rotation-PartB.Rotation

CFrame components are often useful in finding local lookVectors (as in, what's the lookVector in the right direction), but for this, a simpler solution is better

3 comments

0

Well, what I am doing is having a part point towards another part using CFrame. Unless I am thinking wrong, the only way I could utilize the Rotation property is if I create a pseudopart for the end value and then compare it to that... I'll give it a shot.

0

CFrame.new(partA.Position, partB.Position)

0

I already use CFrame.new(partA.Position, partB.Position) to find where I want my object to point. The thing I want to figure out is how to get a smooth transition using a for loop for example to get to where I want the object to point.

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