AlignOrientation does not use values relative to the airship

AlignOrientation does not respect the orientation of the airship when calculating rotation. For example, if I turn the airship a certain direction, then try to apply a tilt, the tilt is applied relative to the worldspace instead of the ship.

I’ve tried using ToWorldSpace, however that hasn’t done anything. Here is my alignorientation code:

	local alignOrientation = Instance.new("AlignOrientation")
	alignOrientation.Parent = parent
	alignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
	alignOrientation.Attachment0 = model.Main.FlyAttachment
	alignOrientation.MaxTorque = AirshipConfig.DefaultMaxTorque
	alignOrientation.Responsiveness = AirshipConfig.DefaultResponsiveness
	alignOrientation.MaxAngularVelocity = AirshipConfig.DefaultMaxAngularVelocity
	alignOrientation.PrimaryAxisOnly = false

And below is my alignment code:

    local newCFrame = CFrame.Angles(math.rad(nLean), 0, math.rad(zLean))
    alignOrientation.CFrame = newCFrame

Thank you for any help!

You could just manually insert the AlignOrientation in your ship with all those Properties set.
There are many ways AlignOrientation can be set. If you set it to align to an Attachment in the hull of the ship all you need to do is rotate the Orientation of the Attachment in relation to the hull.
When done that way the Attachment acts like a joystick. Change its Orientation and the AlignOrientation tries to move to that Orientation.

That’s the wrong function, you would want to use :ToObjectSpace(). Try parenting the attachment to the ship instead.