Semi-realistic space flight model using multiple thrusters
This is less a coding issue than more a conceptual question to the following problem.
I've created a thruster script that works well and applies force on a ships "hull" depending on where it is placed. So I put 4 on top, bottom, 2 on each side. Each thruster can be disabled (get damaged, shot). The thrusters are fired based on the inputs to rotate, pitch, strafe the ship.
So my problem is now that I have to place them exactly on the right spots of the ships hull to get it strafe down / up or even just forward correctly. For example if the rear / main thruster is not place correctly, the ship is going to fly not in a straight path forward but moves it's nose up and "flips over".
Any idea how I can get the "simulated" thrusters and have them behave the way I want without the need to place them 100% accurate? This would become even more funny with attached rockets or other gear to the ship that would alter the mass and center of gravity.
I'm afraid I don't have a concrete answer to offer, but I would recommend looking into Quad-copter stabilization methods.
When you know a maximum acceleration at several points, you'll be able to push forward with an optimal distribution of force.
Unfortunately, I haven't tried implementing it myself yet, and it's not something easily handled by pure guesswork, or I'd offer more than a suggestion of where to look.
Answer by trevorchico · Jun 04, 2016 at 03:53 PM
Thats rough! sounds like a problem I had in calculus class or something.
You could try adjusting the thrust on rocket based on the nose cone x and z position? I feel like thats how NASA would do it?
If (positition.x < startposition.x) Thrustpower++.
That would take a lot of testing and trial and error as well though...
Answer by 3ddave · Jun 04, 2016 at 04:14 PM
The simplest method that would maintain realistic physics would be to designate some type of grid or snap point that the thruster is attached to. Divide the hull into some integer number of positions. For example, a 10 unit wide hull might have a thrust point every 1 unit. Do the same for height. This would yield a grid of points. By using a discrete range of points instead of a continuous range it should be much easier to align parts to symmetric locations. Adjusting the granularity of your grid will make it easier/harder to get correct alignment.
It may be the case that you don't want an actual "snap to" feel for the user. If that is the case, then you can make the grid points "virtual." When the user selects a position to place the thruster, visually place the thruster at that location but computationally store the nearest grid point to that position and use that for your calculations. Hope that makes sense, let me know if it was unclear.
Your answer
Follow this Question
Related Questions
Boost effect on KeyPress. 0 Answers
wing suit physics 1 Answer
Making a rigidbody "immune" to reacting with another specific rigidbody? 0 Answers
Why Does Bounciness Affects Rigidbody Velocity? (SOLVED) 0 Answers
Idea to know how to give realistic movements to a spaceship ( A sort of delay ) 0 Answers