How to replicate a BodyGyro's functionality

You should be able to use AlignOrientation in OneAttachment mode somewhat interchangeably with legacy bodygyro

AlignOrientation

I tested this with my heli that I made a couple months ago, the way I set it up was by using one attachment to attach the AlignOrientation to the main part.

image

Then you can set the alignment via cframe just like bodygyro.

Gyro.CFrame = CFrame.Angles( blah blah blah yada yada

make sure you set the maxtorque and stiffness etc. values. I used math.huge for max torque when ā€˜flyingā€™ then set to zero when idle/off and max angular velocity to infinity

image

yes, actually! When ascending straight up the counter-force was applied correctly, but when tilting or turning it began to spiral. I donā€™t have the version which used this system still around to check, but I have a few backup files. I could probably recreate it to double-check, but Iā€™m focusing on a system that doesnā€™t even use vectorforces to avoid the issue all-together now.

local Object = ???
local v = Object.AssemblyLinearVelocity
Object.AssemblyLinearVelocity += Object.CFrame.RightVector*(0-((Object.CFrame:VectorToObjectSpace(v)).X))

This should eliminate excess forces that arenā€™t in the Z axis relative to Object. Hook it up to a stepped listener.

1 Like

Wow, I had no idea about the single-attachment mode. I feel incredibly silly about not knowing about this :sweat_smile:

Iā€™ve copied this down and if I return to the other system, Iā€™ll definitely hook this in. Thank you!

In my heli I use CFrame.lookAt rather than Angles and itā€™s hooked up like so where Mouse is Mouse.Hit, passed in from the client via remote event.

Gyro.CFrame = CFrame.lookAt(Base.Position, Mouse)

The single attachment alignorientation works as expected, though!

I put some pictures and more comments in if you scroll back up a bit.