Godot 4.1.4.rc (compiled with Voxel tools addition): Releases · Zylann/godot_voxel · GitHub
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?
Help is appreciated!
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”.
Thanks for the help, I’m still not quite getting it to work…
It seems the TerrainCollisionMask is not detecting collisions at all regardless of collision layers & masking.
Current node setup:
I will read up on the proper node to use for masking the collision, but currently I don’t see why I should use anything but Area3D?
EDIT: I probably should show the properties of the TerrainCollisionMask as well:
What code are you using to detect the collision?
This is pretty much all I have:
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!
Thanks for the help!