- Home /
Mesh collider cost
Hi there,
I'm creating a 2d melee game, star control style, and wondered if mesh colliders for the 2-4 players (and sphere/capsule for everything else) would be too expensive for the iphone? Are there any other drawbacks with mesh colliders that I should be aware off (e.g. will it make a bounce unpredictable when colliding with some other mesh?)
Thanks Mike
Answer by Eric5h5 · Oct 18, 2010 at 11:12 PM
Is there any reason for using mesh colliders? Typically, dynamic objects use primitive colliders, or compound primitive colliders if a single one isn't accurate enough.
Not really, beyond wanting enemies projectile hits to be accurate and not register false positives- Imagine a $$anonymous$$lingon shaped (crescent) ship- a capsule would cover it all, but be quite inaccurate?
mesh colliders don't collide with each other anyway, it seems, so I think compound is the right answer, thanks!
$$anonymous$$esh colliders will collide with each other if they're marked convex, but that has various limitations (like, the shape must be convex), and compound primitive colliders are still faster.
that's fine. I found elsewhere that adding child objects with primitive colliders is the way to go and even though you have to attach the collision script to each, it only fires the script if a collision occurs, so there is no additional overhead. I spent the evening deciding which of the primitives to use to capture the collisions for each ship.
It's a shame there aren't more primitive shapes available-- especially with triangular shapes, as the capsule, sphere and box colliders don't always fit that well.
@$$anonymous$$ike: you don't need to attach a collision script to each, only the parent object.