Changes to FloorMaterial Replication

What’s the point of this property now, if listening to its changes is bad for performance?

I really don’t understand it. What happens internally when we access this property? Does it raycast 9 times and then gives us a result? :slight_smile:

If so, can someone tell me what’s the point of using this property if it turns out to be really bad for performance?

1 Like

FloorMaterial catches all edge cases, while a single raycast might miss the floor if the humanoid is standing on the edge.

2 Likes

Haha kinda surprised it wasn’t already calculated this way.
Thanks for the update!

More likely than not, non-network owned humanoids will not be “fully simulated” for performance reasons, so the humanoid does not compute the FloorMaterial property.

However, network-owned humanoids will be “fully simulated”, so the humanoid is already doing the computation for the FloorMaterial property, regardless of whether or not the property is read. In this situation, reading the FloorMaterial property will not trigger any additional raycasting. This is very efficient if you are perhaps listening to FloorMaterial property on the local humanoid to play custom footstep sounds for different kinds of part materials.

There is a performance improvement in that for games not using the FloorMaterial every frame because now we no longer replicate an unused property. Additionally, accessing the property perhaps whenever a Humanoid changes to the jump state would probably not be too much overhead and you would not have to implement your own raycasting.

So it’s really dependent on your own use case.

4 Likes

Can we get access to the internal floor normal calculated by humanoids? Sure, you could fire a single (or multiple) raycasts down to find it yourself but since the humanoid is already doing it better it’s just extra wasted raycasts.

6 Likes

I was expecting this change for quite some time, and I cant say that I’m too mad about it. I’m wondering about the preformance effects of this change as I imagine it’s pretty great. I do actually wish this was completely toggled in the settings because most experiences on Roblox dont use this feature, and some do (IE server-sided movement sounds).

I’d imagine in the future there will be a better community written version of this, but for now au revoir!

1 Like

This change is extremely useful as in addition to some performance benefits, it also improves server side sanity checks to determine if a player is actually grounded or not on the server and not locally it self (as this member was previously calculated locally on the client and then replicated to the server) and clients can no longer spoof this member anymore finally.


If so, can someone tell me what’s the point of using this property if it turns out to be really bad for performance?

@focasds The humanoid may cast up to 9 rays to determine the floor reliably in some edge cases and it’s worth reminding you that ray casting is very cheap over short distances. For longer distances, they have been improved performance wise thanks to this update: Upgraded, Improved, and Faster Raycasts

1 Like

when will we get a humanoid.FloorPart property i mean i love this update and all but i feel like it wouldnt be too costly on performance right? you are searching for the part already anyway so you might as well give the part as a property as well so we dont have to repeat the floor checking even though the humanoid system is already doing it

One complication that prevents it from being a “free” addition is that it’s less likely to “just work” out of the box:

  • If you have one foot on one part and the other foot on a different one, will the code using FloorPart do the right thing? The same issue does exist for FloorMaterial but its less likely to cause issues in practice because you’re less likely to being doing something gameplay critical with the result.

  • What if the FloorPart is terrain? To work correctly all the code using FloorPart would likely have to handle both branches (Terrain vs non-Terrain) separately. FloorMaterial doesn’t have the same issue.

3 Likes

I think I’ve found some type of bug within this change because my shadows have a huge circle cut out every time I change position

This was working before the update and this is bugged in multiple games other than just mine.

This is what is looks like:

1 Like

ohh i see why this isnt a thing yet; in that case is it feasible for roblox to tell how they get the floorpart is it just simple raycasting every frame??

edit: am asking cuz i wanna make a function for this and open source with a buncha other things i made

Is there a way to view this script that you’re talking about? I’m interested in seeing how that’s done.

1 Like

Hi, what game is this? And/or how are you using Humanoid.FloorMaterial?

Hey, I believe their issue is related to mine also:

I’ve attached a repro file in there.

1 Like

I’ve been unable to repro this… what sort of device are you using?

Going back into this place again, it seems that the issue has seemingly been fixed. I will try also looking in my studio’s place, where the issue was much more prominent.

I’ve been unable to reproduce this in my Studio place any longer, either. This issue should be marked as solved, then - @AdamMZTE could you confirm that it’s also been fixed on your end?

2 Likes

Yes! It has been fixed for me and my friend.

3 Likes

I look for what the player is standing on every frame for my anticheat. I raycast up to 5 times to see what the player is standing on and so far it hasn’t failed me.

Should I be switching to FloorMaterial instead? How secure is this property? My anticheat is running every frame so would this be more performant costly than my current solution?

Yeah? It’s just a replication update, it won’t really change that much other than the client not being able to spoof the FloorMaterial.