How to get CFrame.Angles from Motor6D?

Lets say i want a CFrame.Angles() from weld.C0, how do I go about this?

I would like the same for a 3-component CFrame.new().

This is a different version of my older post.

Using bases like these for CFrame values for lerp animations.

Just need the CFrame.new() position-type stuff and the CFrame.Angles() rotation-type stuff for the animations to pose the arms, legs, and torso.

I have tried many things such as:

CFrame.fromOrientation()

And:

C0.Position.X/Y/Z

Thank you in advance.

(Old post: Convert CFrame rotation matrix to CFrame.Angles)

Weld C0 is ALREADY a CFrame. This is neither part CFrame, rather something called transitional CFrame. To get position and rotation of the part, will depend on which part is Your Part0 and which part is Your Part1. You will also need to know the CFrame of at least one of them, as the C0 property only tells you a relation between them.

Generally:

weld.C0 = Part0.CFrame:Inverse() * Part1.CFrame

So to get Part0 CFrame:

p0cf = Part1.CFrame * weld.C0 * weld.C1:Inverse()

And Part1:

p1cf = Part0.CFrame * weld.C1 * weld.C0:Inverse()

To get Position of any CFrame:

pos = someCFrame.Position

To get only Angles component of a CFrame:

angles = someCFrame - someCFrame.Position

Everything except angles works,

I’m attempting to turn the rotation matrix into something like this:

CFrame.Angles(_, _, _)

_ = blank value

Its to make it readable to me so I can spaghetti code a bunch of lerp animations.

–removed frommatrix question

The left hip output from my script gives me this for angles and position:

CFrame.Angles(0, 0, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) CFrame.new(-1, -1, 0) --Left Hip

Ideal output:

CFrame.Angles(_, _, _) CFrame.new(-1, -1, 0) --Left Hip

You cannot Lerp rotations on only 3 values, as rotation matrix is not the same as Orientation.
Rotation matrix has 9 components (3x3, hence matrix).

When you rotate an object in 3 axis it depends on what order you apply rotation. You WILL end up in different orientation, depending on the order of axis you have chosen to rotate it.

You may want to lerp orientation instead, but because orientation is prone to floating point errors when the object is facing up or down, this is not recommended.

For proper lerping/tweening You HAVE to use rotation matrix. (all 9 components, but due to math hacks you may get away with 6 probably - do not quote me on that.)

1 Like

Ah. Alright. Thank you!

(limit)

I actually found a workaround for this, put it into CFrameValue’s Value property and then access the angles through that.

(studio only)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.