Godot Version
4.3 stable
Question
For 2 different colliders on a character, how the both can collide with the ground of my level scene (and not only one)?
Simple question for some of you I think but I tried multiple switches between layers and masks and unfortunately nothing seems to work.
- Here the Body Collider (a capsule) attach directly to the CharacterBody3D:
- Here the Head Collider (a sphere) attach directly to an Area3D in the helmet sub tab of the model:
For conclude, my test level is composed of props and ground all in the Layer/Mask 1&2 in the same StaticBody3D so it should be work no? The capsule and the sphere can not collide between them but must collide with the ground or maybe I am wrong, so please tell me!
Layers and Masks are still a bit confusing, when I do some tests with balls and one body collider physics works, my character can push it and collide with ground. But in this case of two different colliders in the same “model” character it does not work as expected.
Thanks for your time!
1 Like
You can add multiple collision shapes, it seems like you made the head a child of an Area3D, but you do not have to do this, the CharacterBody3D can have multiple collision shape children.
Name your physics layers, I like to keep layer 1 as “World Static” representing world collision that is not generated or does not move. If you want layer 2 to be “Player” then keep the player’s collision layer as only 2, and it’s mask as 1 and/or 2.
I see what you mean but in my case, the sphere collider must be attach to the head (who as a child of the rig node) for the collider match with the movement of the head. So I tried to put an Area3D in the “head child” for autorize the collision shape who are not directly attach to the CharacterBody3D.
As you you can see, for me this is for now the only way to follow correctly the head mouvement and collide with the world if it is on the front when my character walk or jump for example.
I do not know if what I try to do is possible, indeed when I remove my sphere collider for attach it to the CharacterBody3D directly it works but it is always here, even if I roll or crouch for example and this not what I want you know.
I’d like to argue that you probably do not need accurate head collision. As evidence a Area3D does not collide with the world, so if you feel this is accurate, then you do not need a collision shape for the head. Most games do use generous hitboxes instead of accurate ones, they feel better in-game.
You could try to use a RemoteTransform3D node as a child of the bone attachment to copy it’s transform to a CollisionShape.
Indeed I wanted to explore this possibility of a “skinny” body collider, but I will use a biggy classic hitbox, this is not so terrible in the end. Thanks for your help in all case!
EDIT: consider this topic closed for now, however if any one else in the future find a tip to achieve this quest I will be grateful. o7