Upper Body Tilt

Hey Scripters,

I’m working on a tilt system for a game. This is an R15 only game. I want the upper body to tilt towards the camera facing. Unlike the many resources that solve this, I also need the arms to face towards the camera as well. As you can see from the picture, especially the Downward one, this isn’t happening. How can I make the arms face the proper direction alongside with the upper torso. An animation is playing, but it doesn’t seem like the head suffers the same fate as the arms despite all those pieces being in the animation.

Here is the current Lua code in place presently to try to make that happen. Irrelevant pieces have been omitted.

	local uTorso = character:FindFirstChild("UpperTorso") or character:FindFirstChild("Torso")
	if not uTorso then return end
	local waist = uTorso:FindFirstChild("Waist") or uTorso:FindFirstChildWhichIsA("Attachment")
	if not waist then return end
	local leftShoulder = character:WaitForChild("LeftUpperArm"):FindFirstChild("LeftShoulder")
	local rightShoulder = character.RightUpperArm:FindFirstChild("RightShoulder")

	RunService:BindToRenderStep("LockCursor", Enum.RenderPriority.Last.Value+1,function()
		local cameraDirection = root.CFrame:ToObjectSpace(camera.CFrame).lookVector.unit

		waist.C0 = CFrame.new(waist.C0.Position) * CFrame.Angles(math.asin(cameraDirection.y), -math.asin(cameraDirection.x), 0)
		leftShoulder.C1 = CFrame.new(leftShoulder.C1.Position) * CFrame.Angles(math.asin(cameraDirection.y), -math.asin(cameraDirection.x), 0)
		rightShoulder.C1 = CFrame.new(rightShoulder.C1.Position) * CFrame.Angles(math.asin(cameraDirection.y), -math.asin(cameraDirection.x), 0)
	end)
1 Like

For anyone wondering, someone helped solve this using the Transform property of Motor6Ds combined with the Stepped signal of RunService.

1 Like

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