Character Rotation

local lookAtXZ
local newRootCF
function CharacterFaceCamera()
	lookAtXZ = HumanoidRootPart.Position + Vector3.new(Camera.CFrame.LookVector.X, 0, Camera.CFrame.LookVector.Z)
	newRootCF = CFrame.new(HumanoidRootPart.Position, lookAtXZ)

	local tweenInfo = TweenInfo.new(
		0.15,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)
	local tween = TweenService:Create(HumanoidRootPart, tweenInfo, {["CFrame"] = newRootCF})
	tween:Play()
end

RunService:BindToRenderStep("cameraControl", Enum.RenderPriority.Camera.Value, LockCamera)
RunService:BindToRenderStep("characterFaceMouse", Enum.RenderPriority.Character.Value, CharacterFaceCamera)

In my game I have code that will basically point the HumanoidRootPart towards the mouse, but I want the UpperTorso, LowerTorso, Arms, Head to bend and point up and down depending on where the player is aiming but I have no idea how to do this.

I think this by egomoose would help.

It shows some really good practice with cframe and has what to do in order for a body to follow the camera

3 Likes

I think this may be a better fit for the question.

It shows how to have the character bend arms torso and head up and down for an FPS, but im sure it would be enough to make work for whatever purposes.

2 Likes

You could try simply bending the UpperTorso and HumanoidRootPart at the same time. Since the arms and Head are all connected to the UpperTorso, I’m pretty sure the arms will move with the UpperTorso, similar to how they move if you’ve ever used Animation Editor.

1 Like

Oh yap that would be a better suggestion, I didn’t see this one yet time to read it!