Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

The target platform of my game is mobile devices therefore I try to develop it performance oriented. It will be a strategy game so I don't really need physics in it, consequently I did not add RigidBody to my object to avoid unnecessary computations. However according to the Box Collider reference page, the collison event cannot be triggered, unless one of the objects is a RigidBody. Is there a simple way to check collision between objects other than using RigidBodies? Or can it be that I'm overreacting this performance thing and the physics engine won't slow my game down?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

What you're doing sounds a lot like premature optimization to me. Did you try using the physics-engine and did it actually turn out to cause performance issues?

If you don't need the physics-simulation and just care for the collisions, why not use sensors (or "triggers", as they are called in Unity). For stationary objects, use a collider with the Is Trigger checkbox ticked. For moving objects do the same, but also add a rigidbody and set it to be kinematic.

That way you'll only get collisions out of the engine and no other simulation is necessary (use the OnTrigger... callbacks instead of the OnCollision... ones).

If you only need to detect collisions in 2D and the physics engine really turns out to cause performance issues (I highly doubt that, but I have no clue how your game looks like), then you could probably get away by representing your entities as circles and just do a very fast circle vs. circle test?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.