Making BodyGyro Properties match with AlignOrientation Properties?

So for a little bit, I was a bit confused on how i should be doing as According to Docs, BodyGyro should be replaced with AlignOrientation due to its Deprecation a while back, but I’m to update some old code that I found within one of my friends games to have the properties from BodyGyro to match AlignOrientation, but after looking at their Properties and Requirements, I’m confused on how to do this.

So this is the BodyGyro part of the script that I am Attempting to Update:

local BodyGyro = Instance.new("BodyGyro") -- Instance
BodyGyro.Name = "Gyro" -- Name
BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) -- MaxTorque
BodyGyro.D = 50 -- How much Dampening to use to reach the CFrame goal
BodyGyro.P = 500 -- How Agressive the Torque is
BodyGyro.Parent = HumanoidRootPart -- Parent
BodyGyro.CFrame = HumanoidRootPart.CFrame -- Parent's CFrame

But, to add a little bit of info, This is Supposed to be a Swimming Script and the BodyGyro is supposed to Rotate the Player a specific Direction when they press a certain key on their Computer.


But as I stated before, BodyGyro is now Deprecated, and Recommended by ROBLOX to use AlignOriendation Instead, and to explain what I’m confused about:

For the First thing, BodyGyro and AlignOrientation has different Properties, and some are Missing from BodyGyro, like D, and P. This could just be me not knowing what the Properties are, or what they are now named in AlignOrientation.
The Second thing is Attachments, I’m not sure how I should be using Attachments as AlignOrientation uses Atachments, I know how to change from TwoAttachments to OneAttachment but I dont see how that would help, and even if it is, I dont know How should I be Positioning it.

Can anybody help with this?

AlignOrientation uses an attachment to get its information about orientations rather than a part. Bodygyro and AlignOrientation do not use the same formula to calculate the angular force (I think) and I believe that Bodygyro uses a spring based formula, and AlignOrientation uses a lerping formula, so to clear up any confusion about what the property means:

-OneAttachment means that the constraint solves to meet a defined goal

-TwoAttachment means that the constraint solves to meet the orientation of another attachment

-Responsiveness describes how fast it accelerates to meet the goal

-RigifityEnablesAllows the physics solver to solve as fast as possible to meet the goal

-ReactionToqueEnables allows the movement of one part to be applied on another, vice versa (rotational movement only) (there is no longer a goal to meet)

-PrimaryAxisOnly allows the forces applies on a selected axis only

I know what the Properties are, I dont know how to apply them to AlignOrientation to have them work similar to BodyGyro

I’m pretty sure its just that AlignOrientation uses Attachments to Rotate stuff, and BodyGyro does not.

If you want the same kind of smooth turning that bodygryo had, you just have to tinker with the properties of AlignOrientation as I believe that there is no correlation between the two of them and their properties
(sorry for the late response)

1 Like

Bumping this because I’m still wondering.

1 Like