Page 1 of 1

Space sim. Some questions

Posted: Thu Sep 27, 2012 7:17 pm
by foxxof06
Im planing arcade space simulator. So i have some issues.
1. Which physical object presentation choose for space ships (box + box + box, convex hull etc)?. I think the best would be to use Compound object, but how realize the explosion ship? I was thought at the time of the explosion to remove the basic physical object of ship and instead create some primitive objects flying in all directions, the second option was to use Joints for connection between each parts of space ship, but with high dinamic of my game will be a problem in the stability of physic simulation.
2. What the best way to implement the free rotation of the ship (as a free camera)? The simplest and low expensive way - directly use a rotation matrix, and not calculate the angular velocity and etc, this method is easier to use in the implementation of artificial intelligence, but i think its wrong :)

Thanks from Russia for your awesome engine!!!

Re: Space sim. Some questions

Posted: Thu Sep 27, 2012 7:30 pm
by Norbo
1. Which physical object presentation choose for space ships (box + box + box, convex hull etc)?. I think the best would be to use Compound object, but how realize the explosion ship? I was thought at the time of the explosion to remove the basic physical object of ship and instead create some primitive objects flying in all directions, the second option was to use Joints for connection between each parts of space ship, but with high dinamic of my game will be a problem in the stability of physic simulation.
Pick the simplest representation that does what you need. I would recommend against creating a ship connected by physical constraints for performance reasons. A compound object would be likely be the best option if you can approximate the individual pieces of the ship with relatively simple primitives like boxes, cylinders, and so on. ConvexHullShapes can be used in the compound shape for areas which require more fidelity.

If you find yourself needing triangle-accurate collision, using a mobile mesh shape would work. By virtue of handling so many more pieces, these will end up being slower than a CompoundShape of a few primitives and convex hulls.

Ship destruction would be most simply handled by simply replacing the 'alive' version of the ship with a 'destroyed' version composed of multiple pieces flying out.
2. What the best way to implement the free rotation of the ship (as a free camera)? The simplest and low expensive way - directly use a rotation matrix, and not calculate the angular velocity and etc, this method is easier to use in the implementation of artificial intelligence, but i think its wrong
That depends on what the goals of the game are. Manually changing an entity's orientation every frame will indeed interfere with collision response. If ships don't tend to spend much time in contact with other objects, this won't really matter.

Using an EntityRotator (which, for dynamic objects, is just a simple convenience wrapper around a SingleEntityAngularMotor) to achieve target orientations would make the ship face the desired direction with some configurable power. Since it's a physical constraint, the motor will preserve collision response.
Thanks from Russia for your awesome engine!!!
Thanks and you're welcome :)