So, I'm now programing the collision system for my game, and when my ship hits a asteroid two things happen:
I loose control of my ship;
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.
Answer by Sirithang
Jul 31, 2012 at 03:20 PM
Well maybe try to change the mass no? :D
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...
I guess those tips worked, and are going to be useful in the future! Thanks!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
7 People are following this question.
How to make first-person work in zero-G with planets?
How to make an infinite mass solid body
How to build a spaceship with interior?
How to get rid of jumpy collisions?