Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I use the rotation values for CFrames?

Asked by 9 years ago

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

Log in to vote
0
Answered by
wazap 100
9 years ago

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

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. Wafflehagen 20 — 9y
0
CFrame.new(partA.Position, partB.Position) wazap 100 — 9y
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. Wafflehagen 20 — 9y
Ad

Answer this question