How to make my player hold a glb object that uses collision

Godot Version

4.6

Question

How can I make an object that my player is holding use collision and have the player also respond to the collisions?

I’m pretty sure my description is weak so here’s the scenario:
I have a player object that responds correctly to collisions - a large cube in the player path stops the player, etc.

Next, I add and object glb as a child to the player - let’s say simple lance created in Blender.
I can easily add a CollisionShape3D to the lance as a child, but when the lance encounters the cube it passes right through.

What I’ve done is to add another CollisionShape3D to my player that approximates the lance. This works, however, the collision shape is a child of the player, not the lance .
While it works, it means that my lance object does not have a collision shape, and each time I use that object, i need to create a new collision shape.

is there any way to add the collision shape as a child the lance, preferably in the glb file (or as a tscn) and have it affect the player?

You can use name suffixes in your modeling app to tell Godot to automatically create colliders.

A MeshInstance3D has no collision detection.

  1. Create a StaticBody3D
  2. Add the MeshInstance3D as a child of the StaticBody3D
  3. Add your CollisionShape3D as a child of the StaticBody3D
  4. give the StaticBody3D to your Player, attaching it to a BoneAttachment3D that maps to your player’s skeleton.

I’ve tried that - it’s basically the same as adding collision objects after importing the glb.

The issue is that the collision objects just pass right through environmental collision objects.

Once I attach another collision object to my player it works as expected.

Thanks - I will try this

Then your collision layers/mask are probably not set up correctly.