Benefits of using collision component over just mesh component?

Hi, I’m using a line trace from the player character to check for any items I can interact with, using an interface.
Should I just rely on the item mesh for the collision, or should I attach a collision component to it? Bear in mind need to simulate physics on the items too, and that requires collision on the mesh itself.
What are some best practices? Thanks.

Collider objects are with pretty simple geometry and this makes them quite efficient. I would suggest using them whenever you can get away with it.

Now how faster they are compared to a mesh - it depends on the mesh. If it doesn’t create a performance problem maybe leave it as is but if you need a comparable test just profile it.

1 Like

Thanks, I’ve been playing with it, and I’m using an interact interface on a static mesh component to check which components I can interact with using a line trace from the player.
Unfortunately, I cannot find a way to implement that interact interface on the collision box, because you can’t extend the collision component apparently. Would love to know if there’s a way.

Yea, you can change your logic around a bit to make it work. For example:

  • Check if the box is a child of “cant interact with” parent
  • Check the box ref against a list of intractable components
  • Extend physical materials to hold “intractable” property (they already hold Damage Multiplier)

To be fair though, for the occasional line trace it shouldn’t make a big difference. Stick to your current approach and if you think you can do better - profile.

2 Likes

Thanks a lot.
My line trace runs on tick though. Don’t know if that’s reason enough to try collision components.

How would you add a collision box to a list of interactable components?

The short answer is “manually” :wink:

This might not be the best of ideas though…

1 Like

You can also add a Component Tag for specific identification.

2 Likes