Issue with CFrame.Angles / math.rad

Hello! I am almost done with a combat system for my game, but I’ve ran into a problem. I have a gore system for my game, and I add it on once a certain part has been hit several times. I have this part under the character and I make the Left Hip, which usually connects the Left Leg to the Torso, to the new part. I then change the C1 Position and Orientation, but this is where the issue arises. I cannot seem to figure out how to change the orientation correctly! Here is my code:

hitChar.Torso["Left Hip"].C1 = CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.Angles(0,math.rad(45), 0)

The position is set just fine, but the orientation is somehow set to 45,90,90 instead of 90,45,0. If you have any idea on how I would go about fixing this, please let me know! I am not very experienced in CFrame.Angles and math.rad(), so any answer you give, even if it doesn’t solve the issue, will still be greatly appreciated. Thank you for reading!

You were first rotating around the X-axis (math.rad(90) ), then around the Y-axis (math.rad(45) ). If you aren’t getting the outcomes you wanted try adjusting the order, the Y-axis rotation to come first, followed by the X-axis rotation.

CFrame.new(0, -0.5, 0) * CFrame.Angles(0, math.rad(45), 0) * CFrame.Angles(math.rad(90), 0, 0)

This swaps the order of the rotations, making the Y-axis rotation is apply first, followed by the X-axis rotation, and then the Z-axis rotation

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