HumanoidRootPart Positioning Adjustment for Automatically Scaled Humanoids

Hi Developers,

We have released a change which adjusts the HumanoidRootPart position of scaled Humanoids so that the the bottom of the HumanoidRootPart is aligned with the hip joints of the Humanoid. This means that the Humanoid.HipHeight property will now more closely reflects the leg length of the character.

One of the reasons for this change is that animations which have an offset in the Root joint to account for a bend in the knees of the character will now be more accurate for scaled R15 and Rthro characters. The positioning of the HumanoidRootPart is also now more consistent for varied Rthro rigs as its position in the rig is now always based on the leg length of the character.

This consistent positioning makes use cases like accurate custom spawning for scaled characters easier to achieve. The HipHeight property can now be used to easily calculate the height to spawn the character at without needing to take into account all the joints in the rig.

Here are a few images showing this change:

One possible issue developers might see because of this change is with custom seat code which uses a hard coded offset for the HumanoidRootPart above the seat. This code can be replaced with the following to accurately place the character above the seat while taking into account the rig and scale of the character.

local function calculateSeatOffset(character)
	local seatOffset = 0

	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if humanoidRootPart then
                local rootAttachment = humanoidRootPart:FindFirstChild("RootRigAttachment")
		if rootAttachment then
               		seatOffset = seatOffset - rootAttachment.Position.Y
		end
	end

	local lowerTorso = character:FindFirstChild("LowerTorso")
	if lowerTorso then
                local rootAttachment = lowerTorso:FindFirstChild("RootRigAttachment")
		if rootAttachment then
               		seatOffset = seatOffset + rootAttachment.Position.Y
		end

		local hipAttachment = lowerTorso:FindFirstChild("LeftHipRigAttachment") or lowerTorso:FindFirstChild("RightHipRigAttachment")
		if hipAttachment then
			seatOffset = seatOffset - hipAttachment.Position.Y
		end
	end

	local upperLeg = character:FindFirstChild("LeftUpperLeg") or character:FindFirstChild("RightUpperLeg")
	if upperLeg then
		local hipAttachment = upperLeg:FindFirstChild("LeftHipRigAttachment") or upperLeg:FindFirstChild("RightHipRigAttachment")
		if hipAttachment then
                	seatOffset = seatOffset - hipAttachment.Position.Z
		end

                seatOffset = seatOffset + upperLeg.Size.Z / 2
	end

	return seatOffset
end

local function positionCharacterForSeat(seat, character)
	local seatSize = seat.Size.Y / 2
	local seatOffset = calculateSeatOffset(character)

	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if not humanoidRootPart then
		return
	end

	humanoidRootPart.CFrame = seat.CFrame + Vector3.new(0, seatSize + seatOffset, 0)
end
72 Likes

Bless :heart_eyes:! This was a very annoying problem I faced with a huge variety of characters, especially with the introduction of Rthro, problem and worries gone! :tada:

6 Likes

Great update and will be very appreciated by developers. :slight_smile:

Haha I noticed as soon as my characters were clipping the ground all of a sudden, took me by surprise. Anyways, a well needed improvement for consistency sake!

6 Likes

yeah same here, a whole bunch of npcs in my game were all clipping into the ground when I woke up
a nice change for sure, but I have a whole bunch of code in a whole bunch of games that teleports people based on the root part, now I imagine they’ll be teleported into the ground half the time
a bit annoying, would have been nice if we got an annoucement beforehand

5 Likes

Really nice. Much easier to have seats with Rthro, R15, and R6. For my card game seats, I can now have them all be at the same height without adjusting them based on hacky math. Huge thanks to the team that released this.

1 Like

This makes moving Attachment positioning in RootParts from R6 to R15 and Rthro easier. Now I don’t have to rewrite a script to have players use R15 or R6. Another wonderful update! :heart:

This will be really helpful going forward. Thank you!

In the future, it would be really helpful to get a heads up on these types of changes before they go live. Our team woke up this morning and found a ton of position related bugs where we assumed the HRP would be in the same location:

We’re currently trying to rush patches out for these and more:

3 Likes

We should have been informed of this change beforehand. Luckily my game isn’t heavily affected by it.

4 Likes

I would also like to request advanced notice for these types of changes.

If we can’t test ahead of time, then at least we would know to check immediately after the update to see how a game may have been impacted and make adjustments sooner rather than later.

Or we could have a setting that would later be deprecated (e.g. there was a lot of time given for rolling out Voxel Lighting).

I think this update will be helpful in the long run though!

4 Likes

I woke up to a bunch of aspects in my game being broken when this change was pushed.
Very unhappy about not being informed beforehand.

3 Likes

Referencing the supported Rig Builder on the Plugins Tab, located next to the Animation Editor
image
image
Importing any rig, the HumanoidRootPart positioning is still on the old offset - not updated to match this updated behaviour.

Thanks for bringing this issue to our attention, we will fix this issue with the Rig Builder.

3 Likes

Me too. I was mildly irritated since I already had to fix that a few weeks ago.

This is a welcome change though! I just wish we had some forewarning.

1 Like

I like the surprise updates, it’s like a slap in the face or a strong cup of coffee in the morning… keeps you on your toes XD

Seriously though, great update! I especially appreciate it when example code is included for things such as the seating code. That really helps out with these changes.

1 Like

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