I would like to know how to rotate a CFrame rotation matrix ( orientation ) using another CFrame.
For example : [ 0, 90, 0 ] rotated by [ 90, 0, 0 ] produces [ 0, 0, 90 ].
I’m conviced that it is done with either ToWorldSpace or ToObjectSpace but I couldn’t get it to work. For those wondering, I am in fact converting the degrees to radians.
It wasn’t working because of the missing argument but it still doesn’t give me what I wanted. Doing * acts as a + giving me [ 90, 90, 0 ]. I will try using ToWorldSpace().
I’m making a custom camera using the gyroscope on the phone. The gyroscop returns a CFrame which is used to rotate the camera. Tough, I’m having issue rotation the head so it matches the phone orientation as it follows the torso. What I’m trying to do is to rotate the phone “CFrame” by the camera CFrame so the axis aligns correctly when the torso orientation isn’t [ 0, 0, 0 ].
If not aligned, the axis will be “swapped” which makes the X be Z and so on.
Surely it is the torso CFrame that needs to be involved in some way? I think if you start with the torso CFrame, multiple by an offset to get to the head position and then multiply by the gyroscrope CFrame that should sort it out
Is the CFrame in ObjectSpace or WorldSpace. Just like the CFrame.Angles example, try playing around with that (like CFrame.Angles(0, 90, 0):ToObjectSpace(Character.HumanoidRootPart.CFrame), or whatever the CFrame you are revolving around.
I tried doing that before but it always led to the axis being swapped if the torso rotation was not 0. If it is on any axis then, the axis works perfectly. I came to the conclusion that just rotation the gyroscope CFrame by the camera CFrame would fix the issue and make it not follow the camera.
So, I’m gathering you want to know the current angle of the CFrame and to swap Y and Z. However, doing that constantly will “glitch” the part. I’m not capable of achieving this, but one thing you can try is seeing if ObjectSpace is being used.