I am making a strategy game where the player manages a crew in the interior of a capital starship. Most of the projectiles and enemy ships are moved by physics.
I have run into an interesting (and frustrating) problem.
I need the player’s ship to remain static, in order to have a navmesh that crew members can move around on the player ship. Yet the player ship needs to seem as if it is moving, and I know it would be nice to have physics-like movement here.
My solution to this so far has been to create a “WorldObject” which contains all physically dynamic objects in the game. If the player ship is turning, I then apply torque to a rigidbody, which then applies its rotation to this world object (a simple match rotation script), and thus everything rotates around the player ship.
In terms of translations, I clumsily apply a force to all Rigidbodies under the WorldObject, which has all sorts of annoying affects. So my first question would be: What is the best thing to do here?
My second problem is caused by the firing of projectiles from my static player ship into the world. There are all sorts of problems caused here, as the projectiles’ velocity vector needs to take account of the movement of the world relative to the player ship. If the world is moving at a constant velocity and rotation, the projectiles that are fired need to travel straight, but if the ship accelerated or decelerates (causing the world to do so), their velocity vector needs to change.
I also have the problem of how to implement AI for enemy ships for this environment. Should I just sack it in and try and develop a system not using physics? Should I find a solution to the static navmesh problem?
Any thoughts or comments are welcome.