I’m trying to an Asteroids clone with a twist: instead of moving in 2D, the ships and asteroids will travel in 3D around a fixed point in space, all at a set radius.
I’d like to keep the same sort of trajectory feel from the original game, and I’ve tried a few different approaches to get the physics to work - but I’m really struggling to find a solution.
My latest plan is this: creating a sphere at position 0,0,0 - that’s my fixed point, making my object (let’s say ship) a child of the sphere, at a set height (0,10,0)*.
Now as the ship is a child of the sphere, if I rotate the sphere on it’s y axis, the ship should turn left or right, and if I rotate the sphere along the x axis, the ship will move forwards and backwards.
so y = thrust and x = turn.
Any trajectory that I apply will need be applied relative to the world, i.e. if I thrust, then rotate, the ship needs to carry on with the same velocity in the direction it was facing, not how it is now facing.
Once I’ve figured the ship out, the asteroids/projectiles should be a doddle, just a case of spawning them and having them move in a random rotation (asteroids) or continue on a trajectory(lasers)**.
In my head - this all sort of works, the trouble is I’ve only been programming for a couple of months and I’m not sure how to achieve lofty goals as above.
I know this might seem like a “Hi, please program my game” post but really, I’m only asking that someone point me in the right direction when it comes to applying all this, so all perspectives are welcome!
- For those curious, the camera will also be a child of the sphere and set at (0,15,0), looking down on the ship.
** Yep, you could shoot yourself in the back.