Is there any way to make align orientation only affect one axis or two axis for the target orientation
i searched for other solutions regarding this issue but couldnt find certain answers that would infer this topic
Is there any way to make align orientation only affect one axis or two axis for the target orientation
i searched for other solutions regarding this issue but couldnt find certain answers that would infer this topic
AlignOrientation doesn’t have a built-in way to lock specific axes. You’ll have to manually manage the target CFrame in a script or use a different constraint like AlignPosition if you only care about position and not rotation.
Manually set the target CFrame to have only one or two axes.
That works, but you’ll need to make sure you’re only updating the specific Euler angles or axes you want to change. If you just pass a new CFrame without preserving the existing rotation on the axes you want to lock, the constraint will just snap to the new orientation entirely.
What are you using it to align?
A part with world orientation?
Another Part?
Parts on a moving vehicle?
Please be very specific with your description so people know exactly what you are trying to accomplish.
AlignOrientation has many Properties and they have to be used correctly in combination with each other. Here’s an old uncopylocked sample place they made to help explain it.
New Body Movers, Physics, Constraints Example.rbxl (35.0 KB)
The setup matters a lot here. If you’re using Attachment0 to track a part, you might be better off just using a HingeConstraint or a Motor6D if you only need one axis of rotation. AlignOrientation is overkill if you’re just trying to lock a single axis of rotation.
I used it in my Construction Site game.
The buckets on my excavator and skid steer loaders use an AlignOrientation Part in the chassis. I tilt this Part with a HingeConstraint set to Servo. The other AlignOrientation Part is the bucket and it only uses one axis of orientation.
That way it doesn’t matter how the bucket is raised or lowered it allows it to stay at whatever angle you control it to. I could have made a multi-segmented arm on a vehicle that I wanted to stay at a certain angle relative to the vehicle and I wouldn’t have to do anything else.
It’s much tougher to get that kind of control with a series of other Constraints, Welds, or other systems. Believe me, I tried!
That makes sense. Using the attachment to act as a reference for the specific axis is a much cleaner way to handle it than trying to fight the constraint’s default behavior. It’s a good use case for why you’d use AlignOrientation instead of just raw CFrame manipulation.
Yes.
For another example, a foot at the end of a leg. You may want to align it to the HumanoidRootPart, but have the hip and knee joints be able to move around as well.
That’s a classic use case for IK or procedural animation. It’s much easier to let the constraint handle the orientation math while the joints handle the limb positioning.
The only issue with it is if you use Welds or Motor6Ds as joints. Since they are CFrame based and the lag between those and physics based Constraints makes for some very, let’s say, ‘interesting’ movements…
In cases where I’ve rotated a Weld’s CFrame C0 or C1 to get a more stable joint than a WeldConstraint and used a Constraint for another Part of the assembly the Constraint won’t move smoothly. In those cases when I rotate the CFRame I put a loop in the script that updates a Property of the Constraint back and forth (like changing the Force from 9999 to 10000) every frame. It forces the Constraint to update and move more smoothly with the entire assembly.
That sounds like a pretty hacky workaround, but I get why you’d do it. Toggling a property just to force a physics re-evaluation is a classic way to deal with the latency between the CFrame engine and the physics solver. It’s better than dealing with jittery assemblies.
Im just trying to make a controller for physically simulated character that uses animation controller and so i use align orientation to rotate the character to input direction but the problem is that it overrides all axis to rotate at that exact target rotation which i dont want to and this would destroy the purpose of what im doing because it overrides the character’s current rotation to match the exact target orientation and this would make the character no longer feel physically simulated
its hard to describe but im trying to replicate the physically simulated units in the game Totally Accurate Battle Simulator and align orientation is correlated to this because in that game it allows you to control units like a standard character controller and by the rotation of the controlled unit changing based on the direction its supposed to go i would try to recreate this with align orientation which lets me put a target cframe