Hi! I am making a script that rotates a player’s character towards their mouse.hit.p (target) every (1/8) seconds, but the BodyGyro does not rotate the HumanoidRootPart downwards or upwards.
Why is this happening? The BodyGyros MaxTorque is set to math.huge on all axis.
Here’s my code:
Is there any fix for this? I tried setting the HumanoidRootPart’s CFrame equivalent to face the direction of the mouse, but that doesn’t appear smooth at all, it is very glitchy.
Can’t do this. The force will conflict with the Humanoid’s internal forces which attempt to force it to remain upright so long as its physics are getting simulated (can be cancelled by either setting them to the Physics or PlatformStand state). You could try moving the character model other than the root to the desired location or switch to CFrames but I doubt that’ll do anything.
Aaah I see! Actually I don’t really need the HRP to face the direction, changing the LowerTorso’s Root Motor6D to face the direction makes it seem like the character is rotated. I tried experimenting with this, but now I am way too tangled up into the code, it kinda works but the orientation is not just quite right:
local weld = player.Character:FindFirstChild("Root",true)
local desired_p1=CFrame.new((weld.Part0.CFrame*CFrame.new(0,0,0)).p,target)
weld.C0=CFrame.new()
weld.C1=desired_p1:inverse()*weld.Part0.CFrame * CFrame.Angles(math.rad(0),math.rad(0),0) * CFrame.new(0,0,0)
thankyou, this worked for me setting Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true), was making a grapple type thing for testing/fun and needed to have the player face the grapple spot without CFraming beause CFraming was getting me stuck in spot thanks.
Set the state to physics like colbert said, I know it’s been a year though so oof but yeah for anyone else who sees this if your setting the BodyGyro of anything on the Character then you need to set state physics so it doesn’t interfere with your BodyGyro.