I have a Player(a CharacterBody3D) , with a Hitbox(a CollisionShape3D->BoxShape3D), and a auto-step-up for stepping single blocks in my blocky terrain named StepUpRay(a CollisionShape3D->SeparationRayShape3D) as children. Like so:
I have an issue with the Hitbox colliding with the terrain when stepping up, which gave me the thought that if I only let the StepUpRay collide with terrain I should get the smooth-er movement I want.
The issue is that I cannot use the collision mask on the CollisionShape3Ds, only the CharacterBody3D. As according to the documentation, ok.
But I expected the CollisionShape3Ds to have this masking property though, since they are the specific colliding elements, no?
I feel a bit lost now, should I create Area3D nodes or something similar for each of the CollisionShape3Ds so I can mask the Area3D nodes separately? Like this?:
But the Player is now missing its hitbox child!
I feel I completely misunderstand the collision mask… But what else is it used for if not for masking different types of collisions? Why are they not a property of the CollisionShape3D object instead? How should I implement what I want properly?
The “Hitbox” should be a direct child of the Player the feet “StepUpRay” can be inside the Area3D “TerrainCollisionMask”. Your character will be the shape of “Hitbox” and the feet will only be a detection Area and can have a different mask from “Player”.
I just realized: is_on_floor() is decided by the Hitbox node. What I really want is for it to be the StepUpRay (I believe).
So this is how I’m thinking:
I think I won’t regret it in the future, hopefully… The hitbox should only be used for detecting being hit by stuff so this is an ok setup for me. I just have to rename the StepUpRay to something better since it represents the terrain-collision detection and not just detecting steps.
The Player can run around and not stumble on itself now at least!