I’ve been working on a spaceship for a game for the last couple of months and I’ve got to the point where I’m working on the physics for the ship.
Basically, it’s a spaceship with a 3D interior for the player to walk around and has a cargo hold that contains an exploration vehicle for the player to get into and drive out of the ship onto the surface of whatever planet or asteroid the ship has landed on.
The ship uses mesh colliders for the interior compartments and player-accessible areas. I’m also (currently) using mesh colliders for the hull of the space ship. The exploration vehicle is a separate GameObject within the space ship GO’s hierarchy currently. I’ll unparent its transform when it leaves the ship and make it a child again when it enters later.
The issue I have is this:
When I add a rigidbody to the space ship to allow the use of physics and the colliders so that it can sit realistically on the test planet surface (a standard terrain), it jerks and slides around in a circle constantly, no matter what values I add to the drag and angular drag boxes for the rigidbody.
I have removed the player controller and exploration vehicle from the space ship model and its hierarchy, thinking their colliders may be causing issues, but exactly the same behaviour is exhibited.
The space ship GO is fairly complex, containing a number of 3D meshes, some animated on a keypress (cargo doors etc), and some with mesh colliders due to allowing the player to walk around inside. I have tried deactivating the hull mesh colliders and replacing them with box colliders in an approximate shape, but then the ship falls through the terrain after catching on a wing before it drops through completely.
The only error messages I am getting are Actor::updateMassFromShapes: Compute mesh inertia tensor… I’ve looked up help on these and I’m not using any flat plane rigid bodies. I am, however, attaching a rigidbody to the root space ship GO, but how else can I use a rigidbody with the ship?
Does anyone have any experience of building complex 3D objects like this and applying rigidbodies to them?
Any help would be greatly appreciated.
The ship GO contains a cargo bay floor that descends using animation. That also has a rigidbody attached.