So, in my game there is a default rig, the only parts we can use are the HumanoidRootPart and Camera.
So. when the camera suprasses a 45 degree angle (to left or right, from where the humanoidrootpart is) How would i make the body turn and look to where the camera is now?
(Example below, Red is the angle based off the rootpart, Orange is the camera angle)
uhh probably make a script that tweens the cameras cframe angle when the A or D button is pressed and whenever you look past the angle it tweens back to original angle
i dont know if thats possible since it will always be updating the cam position so like if your 180 degrees then it would go off even though the rig is infront of you
Id use something like :Dot() in angle between the humanoidrootpart and camera to find the difference and if its larger than the threshold, apply an alignorientation to rotate the player.
something like
if math.deg(math.acos((workspace.CurrentCamera.CFrame.LookVector * Vector3.new(1,0,1)):Dot(Character.HumanoidRootPart.CFrame.LookVector * Vector3.new(1,0,1)))) > 70 then
AlignOrientation.CFrame = CFrame.new(Vector3new(), workspace.CurrentCamera.CFrame.LookVector * Vector3.new(1,0,1))
end
havent tested this, and I’ve left some things out but as a proof-of-concept it should work for you
you could also consider other methods to rotate the player
edit: DO NOT use tween to rotate your character!!! tweens are interrupted by changes such as those caused by physics and are not preformant!! I highly recommend a physics based approach since thatll also sidestep the issue of glitching into walls by directly setting the rotation.