- Home /
one collider for 2 combined object
Hi, I have an obstacle that composed of 2 game object, but when the player collides it, it gets in OnTriggerEnter twice when the obstacle have 2 different collider, which is what it should be, of course. However, I couldnt find a solution for it, How can define one collider for both object properly? Because one collider does not fit for my shape.. if you can answer asap, I will be appreciated, thanks in advance :))
You can use mesh colliders and different colliders that will fit your shape, but also a collider does not always have to fit the shape.
this object is composed of 2 game object. how can I use mesh colliders that cover the whole object as one? Also, if my collider doesnt fit my object, then how the player collides with the obstacle's part that does not have capsule collider? for example, in this photo, if my player hits this obstacle from right or left arm, then it will not collide.. so I didnt understand what your question is going
Answer by warthos3399 · Jun 26, 2021 at 12:19 AM
Use a box collider, and size it to fit, of course it wont exactly fit like a mesh collider, or 2 capsule colliders, but that really doesnt matter, as your only using it as a OnTrigger event.
I dont understand, if I use one box collider ( red dashed line ) for this shape, then my object will be triggered also in green part??? is this box collider what you are talking about? bc if that so, this is a really bad suggestion.
Answer by kskjadav007 · Jul 06, 2021 at 12:25 PM
I think you can add two colliders to one object . I don't think it's a good way but it might work