Collision and physics: asteroid

Hi there!

So, I’m now programing the collision system for my game, and when my ship hits a asteroid two things happen:

  1. I loose control of my ship;
  2. The asteroid goes flying to a place very far away;

First how can I prevent the loss of control of my ship, and second, how can I prevent the asteroid from going to “a place very far away”, and instead just divert slightly its course?

The ship has a rigidbody with a mass of 1, and a capsule collider, while the asteroid (a cube, at this moment) has a rigidbody with a mass of 0.5 and a cube collider. Both rigidbodies are affected by gravity (which is 0 in this scene). At this moment the only scripts I’ve is the one to control the ship, the camera script, and nothing more.

So, how can I fix this?

Thanks in advance.

João Borrego

Well maybe try to change the mass no? :smiley:

As the doc say for Rigidbody.mass, try not to go above 10, and it’s more of a “relative” scale : higher value will move less when hiting lower value and vice versa. So why not try something like 1 for the ship and 2 or more for the asteroid?

For the loss of control, well you can try to play with the Rigidbody.angularDrag, as the doc says “the higher it is, the fastest the rotation will stop”. Same thing apply to the “drag”, that affect the linear velocity (how fast will the mobile come to a top when moving).

You can also try to play with the Physic Material, changing the bouciness or else…