Problem with Root Joints and Body Gyro

I currently have a system where depending on your MoveDirection, you tilt that way.
I also have another system where whenever your holding a weapon, a bodygyro follows the position of your mouse.

The problem is whenever both of these are being used at the same time, like if I’m moving to the right while pointing my mouse in a direction, as seen in the video the body gyro is very off when tilted.

1 Like

simply changing the bodygyro cframe like this by the way

BodyGyro.CFrame = CFrame.new(HRP.Position, Vector3.new(Mouse.Hit.Position.X, HRP.Position.Y, Mouse.Hit.Position.Z)

If you’re changing the CFrame directly when tilting, that most likely overrides the BodyGyro in orientation. One way you could do it is essentially combining the two orientations (the mouse and the tilt) and then plug it into the BodyGyro.

what’s happening is that the tilt system (based on MoveDirection) is applying its own rotation, which is interfering with the BodyGyro orientation.

To fix this, you need to separate the visual tilt from the actual aiming rotation, and then combine both properly.

Try this approach:

local tiltAngle = math.rad(10) -- example tilt angle based on MoveDirection
local aimDirection = (Vector3.new(Mouse.Hit.Position.X, HRP.Position.Y, Mouse.Hit.Position.Z) - HRP.Position).Unit

-- Base rotation toward the mouse
local baseCFrame = CFrame.lookAt(HRP.Position, HRP.Position + aimDirection)

-- Apply tilt visually (on a separate part or using a joint)
-- Or if you really need to combine it into the BodyGyro:
local combinedCFrame = baseCFrame * CFrame.Angles(0, 0, tiltAngle)

BodyGyro.CFrame = combinedCFrame

You can compute tiltAngle based on Humanoid.MoveDirection.X or Z, and animate it smoothly with TweenService if needed. But keep it visual only, unless you’re intentionally tilting the physics too.

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