I’m making a custom character controller(using humanoid) to make movement smoother.
at first, I detect it using a checking part, but It made player climb on walls.
and then I do it with humanoid.FloorMaterial, but it caused player to jump twice.
So, I know there are some ways to do it, but I don’t know what is the best way for me.
I want the speed to be maintained while player is in the air (like air strafing), so I check this every frame. If you know better ways, please tell me. thank you!
For more precision and proper differentiation between grounds and walls. (and other objects)
You could fire a Raycast downwards and make use of Collision Groups. One of the properties of RaycastParams allows you to set the CollisionGroup. You could also check the raycast result to see if hit part is part of your Ground CollisionGroup or not (using the CollisionGroup property of the part).
You could also check the direction of Normal within RaycastResult. The closer the Y component is to zero, the more vertical the surface is. This can be used to differentiate between ground, walls, and ceilings. Check the documentation for more info about it.