Humanoid Part Collision Changing - 'Only On State Change'

If they can go through each other without collision groups, then there’s nothing stopping them from falling through the earth into the void. Or nil, in Lua.

2 Likes

I just quite don’t understand what exactly this update is supposed to bring.

1 Like

This is just a small optimization to cut down on humanoid CanCollide settings per frame, such that they will only be changed when they need to be (i.e. when the humanoid’s state changes). Nothing very drastic, unless you depend on the current setting.

5 Likes

It changes all the parts. It may be represented like so:


Old behavior:

while task.wait() do
    if humanoidIsInState then -- Is humanoid in state
        -- Do stuff
    end
end

It continuously polls the humanoid’s state, and sets the entire humanoid’s collisions accordingly. This runs every frame.

New behavior:

humanoid.StateChangedEvent:Connect(function(state))
    if state == someState then
        -- do stuff
    end
end

This runs only when the humanoid’s state changes, which is not every frame, therefore improving per-frame performance.

8 Likes

How did you go about making custom humanoids?

3 Likes

Can we add a service for these new objects to prevent cluttering up workspace with loads of bloat. I’m sure these could be put under their own services, or for this one, simply PhysicsService.

6 Likes

These settings under workspace are starting to get a little messy, will these ever be moved to game settings instead?

4 Likes

The character wouldnt fall though the ground, because the Humanoid keeps the character ‘hip height’ above the ground even if there is no ‘cancollide’ set.

What this update does, is makes it easier for developers to turn collision on or off to character parts, if they need to. Without having to have a script manually set it each frame.

For instance, in my game, the mermaid crawling animation causes the lower torso, and upper torso to hit the ground. I have to make a script to set these parts to ‘cancollide = false’ each frame, so the crawling animation can play.

This ‘if I assume correctly’ will let developers check for a change in the collision state of the part and then set it how they need it.

Also, its an optimization, meaning less processing happening behind the scene because collision is not being set each frame anymore.

2 Likes

OHHHHH yeah when i make stuff like that it does hit the ground or float or like has a seizure and stuff now i understand thanks

3 Likes

oh, this is interesting considering all the ragdoll use that has been going on lately

1 Like

Is there an ETA for release? I’m heavily looking forward to this change.

1 Like

It’s quite involved and would take a while to fully explain, essentially you use raycasts for collisions and gravity, lerping the CFrame of the entity forward towards wherever it’s going using distance = velocity (walk speed) * time. I’ll PM you a few helpful links I found when I researched it on the forums. If enough people are interested (PM me please and don’t clutter this thread) and I can find the time, I’ll make a tutorial.

Something to note: Custom humanoids are only useful when you need better performance and more control over your entities, as expensive states like swimming and climbing can be disabled. If humanoids continue to be better optimized for 100s of players per server and more, custom humanoid implementations may no longer be needed.

3 Likes

The intention is to eventually remove this setting after any issues are addressed and the default is set to Enabled. This will likely not be a quick process, but we will be watching to see if there are many games that intentionally disable this feature and try to address any concerns they may have to allow them to switch over to the new behavior. This will help keep the interface and code base cleaner.

5 Likes

The option to enable this feature should now appear in Studio for all developers.

For all existing and new places, the value will be set to default. Currently, default will leave the feature disabled, but in the future, we will be switching to enabled once we verify that there are no problems and that is will work for the majority of places.

7 Likes

Fantastic! This has been a bugbear of mine for a long while that made no sense to me.

Thanks for finally fixing this. :grinning::+1:

1 Like

There is a warning relating to this that is plaguing our game’s server output.
What can we do about this?

2 Likes

Do you have a reproduce case that I can take a look at? Ideally a simple place file that causes this error?

3 Likes

What triggers that warning? Would be more than happy to create a simple repro if I knew more about what it’s trying to communicate. If the warning could be adjusted to show the instance path name and maybe a stack trace that would help significantly.

1 Like

It appears that a modification to a Humanoid is being done to a Humanoid that is not parented to workspace. Possibly, this is something that is changing or removing parts to an R15.

I have a few ideas of what might be causing it and how to fix it, but I would love to verify it against your instance of this to ensure that the fix will solve the problem.

3 Likes

Issue a player of my game reported upon me enabling this setting. Player spawned in, new character created, teleported, fell into the smooth terrain and started moving around very quickly before being flung into the sky.

This has never happened before I enabled the setting. May be related to this setting, possibly not.

1 Like