Using FromAxisAngle with all 3 axes

So, I am making a script that sets the part orientation through CFrame in YXZ order because otherwise the values see to mess up a bit, this is the script

			block.CFrame = CFrame.new(endPos) * CFrame.fromAxisAngle(Vector3.new(0,1,0) , math.rad(block.OrientationVal.Value.Y))
			block.CFrame = CFrame.new(endPos) * CFrame.fromAxisAngle(Vector3.new(1,0,0), math.rad(block.OrientationVal.Value.X))
			block.CFrame = CFrame.new(endPos) * CFrame.fromAxisAngle(Vector3.new(0,0,1), math.rad(block.OrientationVal.Value.Z))

Am I using FromAxisAngle right? if not then how would i do that?

you can just do

block.CFrame = CFrame.new(endPos) * CFrame.Angles(math.rad(block.OrientationVal.Value.X), math.rad(block.OrientationVal.Value.Y), math.rad(block.OrientationVal.Value.Z))

That makes it so the angle is done in XYZ order, I need it to be YXZ order

block.CFrame = CFrame.new(endPos) * CFrame.fromEulerAnglesYXZ(math.rad(block.OrientationVal.Value.Y), math.rad(block.OrientationVal.Value.X), math.rad(block.OrientationVal.Value.Z))
2 Likes

nice :shallow_pan_of_food: :shallow_pan_of_food: