Help with AlignOrientation CFrame

Hello, I am asking you for help today to make a rotation system (bike), I have an AlignOrientation so that it remains upright and I would like to change the orientation to be able to tilt the bike to the right or left. Except that on an AlignOrientation it’s complicated because the axes are those of the world and you just have to change direction for CFrame.Angles() to no longer be good. Do you have a solution ?

sp:GetPropertyChangedSignal("SteerFloat"):Connect(function()
	if sp.SteerFloat > 0.2 then
	sp.AlignOrientation.CFrame =  
	elseif sp.SteerFloat < -0.2 then
         sp.AlignOrientation.CFrame =  
	else
          sp.AlignOrientation.CFrame = CFrame.Angles(0,0,math.rad(90))
	end
end)

Thank.

You should break the CFrame into separate parts, with one of them being the rotation along the long axis of the bike for tilt, that way you can control it independently.

Would that mean: one part remains static and the other moves?

No, you can multiply CFrames together to create a complex rotation easier. CFrame.Angles actually just does 3 separate rotations in X Y Z order. Actually you can probably try fromEulerAnglesYXZ since you probably want the yaw to be done first.

Finally, I changed the orientation of the attachment when the Steer value changes and it works well! Thank you for helping me !

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