Moving Humanoid with Disabled FallingDown HumanoidStateType or EvaluateStateMachine Triggers RaycastBroadphase/Terrain Calls

Moving a Humanoid model (e.g., via BulkMoveTo or PivotTo) with FallingDown state disabled or EvaluateStateMachine set to false triggers unexpected RaycastBroadphase and RaycastTerrain calls, increasing CPU time.

System Information:
GPU - NVIDIA GeForce RTX 3060
CPU - 11th Gen Intel(R) Core™ i5-11400F @ 2.60GHz
Memory - 64GB DDR4

A private message is associated with this bug report

Thank you, we’ll take a look at this.

Any update on this?
It’s extremely important when moving around lots of npcs (tower defenses, theme parks, etc)

About half of the time moving the root part is spent doing raycasts
Although if the ground’s geometry is complex enough, then it could easily be more than half
That’s a big deal! Especially on mobile targets :fearful:

A workaround is tricking the humanoid to think it’s RootPart is a fake rootpart that is anchored and doesn’t move

local fakeRootPart = Instance.new("Part")
fakeRootPart.Anchored = true
fakeRootPart.CanCollide = false
fakeRootPart.CanTouch = false
fakeRootPart.CanQuery = false
fakeRootPart.Transparency = 1
fakeRootPart.Name = "HumanoidRootPart"

local realRootPart = model.HumanoidRootPart :: BasePart

-- Jank!
realRootPart.Parent = nil
realRootPart.Parent = model
fakeRootPart.Parent = model

-- Not necessary for "Jank!", but helpful for getting the real root part
model.PrimaryPart = realRootPart

I would kill for a HumanoidAppearance class that only handled appearances, shirts, and pants

(This is for client sided humanoids, I’m not sure what happens on the server)

Whoops, seems like this is still an issue, even made a whole post only to realize (thanks to @averlst) that this is a thing…

Yeah the lag is unreal, TL;DR for my post:

Doing client replication for 400 NPCs every render step made these extra calls VERY obvious, to the point that I’d be getting 10 FPS on my otherwise well optimized system (that with EvaluateStateMachine enabled, runs on 60 FPS!)

Great find! This is indeed a bug. We currently update the sensor data unconditionally when a Humanoid is moved. As mentioned in our docs, sensor updates should be skipped if EvaluateStateMachine is disabled.

Fix should be live in the next couple of weeks.