UpperTorso CFrame rotation help

Hi, I need help with some object space rotation and world space rotation conversion.
https://gyazo.com/dd54db875e6c350b6ab8d59af682ec00

In this clip, while the UpperTorso is upright, the rotation works properly, but when crouch, the UpperTorso is tilted forward, but the rotation of the UpperTorso is only applied to object space Y. I want it to rotation the joint on the world space, but when I tried, the rotation is no longer relative to the body and look direction.

Current:
image
Want:

Thanks!~

Sadly, Due to the nature that the character is R6 You most likely won’t be able to get that perfect upright stance you’re looking for, furthermore you can attempt to snap the torso into two parts and label them UpperTorso and LowerTorso.

The character is R15.

I feel like a complete idiot… have you tried to mess around with the UpperTorso or just have the same script type when in full stance and crouching?

I’ve tried messing around with toObjectSpace with the RootPart’s CFrame without the position vector or using the UpperTorso’s Orientation into CFrame.Angle with math.rad to add use with toObjectSpace but yeah, result was my UpperTorso spinning non stop. Hahah.

This might help.

The thread should add some context. Instead of rightVector, use upVector instead. pitch would be whatever angle you rotate the torso with in the y-axis.

2 Likes

If anything, I’ll help along myself and give an open place to reference to anyone else with the same issue.

1 Like

I tried some of the method but I don’t think I’m making any progress.

https://gyazo.com/b8ba1e4c6670ebf68df764c4531a5b62

Here’s another issue related to the world and object space rotation. Ignore the idle animation but the neck and arms is working fine if the character’s waist c1 is not rotated, but after it’s rotated, the rotations of the neck and arms are relative to the UpperTorso, which isn’t what I want. I want it to rotate relative to the lookVector of HumanoidRootPart.

	local direction = rootPart.CFrame:vectorToObjectSpace(camera.CFrame.lookVector)
	local radian = math.atan2(direction.X, -direction.Z);

	-- < some clamping code here > --

	LerpBody(
		CFrame.new(originaldata.NeckC0.p) * CFrame.Angles(mouseProperties.Y, math.clamp(-radian*0.5, -0.3, 0.3)+characterProperties.Joints.WaistY, 0),
		CFrame.new(originaldata.RightShoulderC0.p) * characterProperties.Joints.RightShoulderAngle,
		CFrame.new(originaldata.LeftShoulderC0.p) * characterProperties.Joints.LeftShoulderAngle,
		CFrame.new(originaldata.WaistC1.p) * CFrame.Angles(characterProperties.Joints.WaistX, radian+characterProperties.Joints.WaistY, 0)
	, 0.1);

I’ll keep trying in the mean time, if anyone has overcome this issue before, I’d like to hear about it.

Made some progress, head now rotations accordingly, and recoil kickback applies relatively. :smiley:

https://gyazo.com/c6b3b71bbcce7041a8790c146d9afa84

LerpBody(
CFrame.new(originaldata.NeckC0.p)* CFrame.Angles(0, math.clamp(-radian, -0.3, 0.3)+characterProperties.Joints.WaistY, 0) * CFrame.Angles(mouseProperties.Y, 0, 0),
CFrame.new(originaldata.RightShoulderC0.p) * characterProperties.Joints.RightShoulderAngle,
CFrame.new(originaldata.LeftShoulderC0.p) * characterProperties.Joints.LeftShoulderAngle,
CFrame.new(originaldata.WaistC1.p) * CFrame.Angles(0, waistRotation, 0)* CFrame.Angles(characterProperties.Joints.WaistX, 0, 0)
, 0.1);

The arms are left to fix…

Found a solution, not the one I wanted but will work for now.
https://gyazo.com/c796e68d01cdf0a3839002be12d8db6e

Rotating the entire waist instead of the arms.

1 Like