How to use OrientationAlign with limited axis?

I’m trying to create a drag part system similar to lumber tycoon 2, and I’m using OrientationAlign object so the part keeps the same orientation.

But I’ve realized that if I set the orientation of the part that holds the Attachment1 of OrientationAlign to something like CFrame.Angles(X,Y,0) the OrientationAlign will try to keep the part at 0 orientation on Z axis.

I don’t know how to work around this, any help will be appreciated.

Thanks in advance.

1 Like

Try using bodygyro instead. New bodymovers lack features.

1 Like

bodygyros are deprecated same as bodyposition

1 Like

Still work tho. What else can you use when ROBLOX refuses to add a proper alternative?

1 Like

It won’t be supported tho.
And also i have made a perfect system using the new align objects.
Should i just move to bodygyro?

1 Like

If align objects don’t have the functionality you require, you can either program the forces yourself or use older bodymovers

1 Like

Hi , I was having a similar issue to you a while ago- I hope this helps!

https://devforum.roblox.com/t/how-do-i-snap-the-z-axis-on-this-align-orientation/2157946/4

1 Like

I see, how would I do that with my case?:

Aori.CFrame = CFrame.Angles(RotX,RotY,0)
1 Like

i don’t get how does the negating a cframe work

1 Like
local GivenCFrame: CFrame = -- cframe goes here
local GivenPosition: Vector3 = -- put the position of the cframe here

local _, y = GivenCFrame:ToOrientation()
alignOrientation.CFrame = CFrame.new() * CFrame.Angles(0, y, 0)

1 Like

That kinda works, but in my case, im trying to make part dragging system and whenever a part is rotated and put down, when i pick it up again, it doesn’t retain it’s position but it goes to default position which is 0,0,0…

1 Like

Okay I fixed it. I have changed it to this:

Aori.Orientation = Vector3.new(x+RotX,y+RotY,z)

the Aori is the Attachment set for AlignOrientation object.
the x,y,z is a reference of the starter position of target part.

local x,y,z = Target.Orientation.X,Target.Orientation.Y,Target.Orientation.Z

And RotX, RotY are the rotation values changed by clicking R key or T key.

1 Like

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