Adding rigid body for the player as well

There was a lecture that we wanted the player to crash. In that lecture, we removed all the imported colliders of the StarSparrow package and used a cube collider instead. Here, for enemies which are spaceships received from the same package, we are adding rigid body on the instance to detect particles hitting them.

We did not do that for the player and we missed all the colliders and their accuracy. I did that for player, added a rigid body to the parent keeping all the child colliders. It did not work.

Can someone explain why?

Hi shampoo,

When using assets that we got from websites, we cannot expect that they are optimised for performance. In fact, they are usually not optimised. For this reason, it might be that we have to fix certain issues ourselves.

The more detailled colliders are, the less performant they are because Unity’s physics simulation has to calulate more. The more enemies we have, the less performant our game will become. If those enemies have complex colliders, that’s even worse.

As game developers, we often have to come to a compromise. In this game, we have to ask ourselves whether the player will benefit from super accurate collisions. The answer is usually “no” because nobody will take a ruler to check if the laser is off of pixel or two. As long as the game looks and feels accurate, that’s usually sufficient. As game developers, we fake a lot.

We could do the same for the star ship but since it’s just one game object and since the game is rather small, we probably will not notice any difference. With dozens if not hundreds of enemies in the scene, the difference will very likely be noticeable.


See also:

That’s an interesting point although t was actually the other way around. The player has simple colliders and enemies have complicated ones. By the way, is there a way to measure the process burden these things have on the game?

Unity has got a Profiler.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms