Hello,
I’m trying to make a realistic physics based spaceship movement, (something like in X4 game) but I got some very strange “wobble” motion/rotation when I try to roll the ship on z (forward) axis. I try to fix it for two days now and I would kill myself at this moment as I can’t fix it on my own… I also check online but I didn’t find anything which can solve my problem.
CONCEPT:
My ship object has rigidbody and it has many children objects (thrusterPoints). The thrusterPoints empty objects with meshrenderer (to help me visualize their positions). The parent ship object also has a script (Thrust.cs).
This script responsible for give thrust (force) to the given point. When I press a control key on my keyboard (say Q for roll left), the script give push by ‘AddForceAtPosition’ at the position of the linked thrusterPoint. Each control key has its own thrusterPoint of course, and they align at the proper position and rotation (force always applied on blue axis “forward”, so I rotate the given thrustPoint object to get proper force direction).
For a left roll with ship I need two thrusterPoint object (called them: rotate_roll_L1 & … L2) aligned opposite to each other (one point up, other point down). The two thrusters mirrored each other position (one at pos: 1:0:0, while other: -1;0;0). So everything in balance to make a good left roll
Relevant code for this:
rigidb.AddForceAtPosition(rotate_roll_L2.transform.forward * force_roll, rotate_roll_L2.transform.position);```
The 'AddForceAtPosition" is relative to parent ship object even if it's use world coordinates as I use the thrusterPoints (rotate_roll_L1-2) positions and they children of parent ship object so the position will be relative to main ship object.
**EXCPETED BEHAVIOUR:**
The ship start to roll along Z axis perfectly (easy to imagine..)
**MY RESULTS:**
I show 3 scenario, where I build different ship by modules (actually, just prototypes here to demonstrate more clearly, build by simple blocks.. ).
- **1st case:**
The "ship" is symmetrical and very simple construction. The center of mass (COM - yellow sphere) is in the middle. I marked the left roll thrusters forward direction (direction thrust applied) as green arrows.. the thrusters are the spheres to visualize, __No question here, it is rolling perfectly!__

- **2nd case:**
I put one block at top of the ships centre.. the COM slightly moved up but not an issue! The ship rotate around blue axis even if the middle of rotation is the COM not ship's middle position. I can fix it easy if I align the ship's position to down a bit (then COM will be at the position 0:0:0). Other fix is to modify COM position by code and put to the middle, but I don't want to "cheat" with the centre of mass of the ship. The picture shows the unmodified version (original position of ship & COM). __Everything fine with this as it's working!__

- **3rd case:**
I moved the extra block to front of the ship, but keep its height. So the COM is not only a bit moved up but also forward. As a result the full ship start to tilt away, not parallel with blue axis... __WRONG!__. If I modify the COM by code and force it to be at middle (0:0:0), then I got the same wrong result! See: the blue relative axis not parallel with thicker blue word axis anymore! So, don't matter where the COM is...

**IMPORTANT!**
I tested other rotations like yaw and pitch! They are working properly without any problem like roll has...
**SOME NOTE:**
**-** Doesn't matter where I positioning the thrusters I got the same wrong rolling.. so, for example, if i put them forward and up.. they forces are "extinguished" each other, so they rolling good as in the first example, but thanks to the different construction of the ship I got wrong result. So, don't say "put thrusters aligned with COM"...
**-** I use only 'AddForceAtPosition'. The idea behind this is the realism... in the real spaceship's thrusters working like this as they give push (when fire the thruster) exactly where the thruster is and push the ship on that point. When all of the forces with well placed thrusters are balanced with centre of mass etc.. the ship is rotating how the pilot want. If I would use torque or modify rotation directly wouldn't be real as they not apply forces from thruster just do on full ship... I hope you got what I'm talking about.
**-** I don't really want to modify the centre of mass of the my ships, as I want to be realistic, but if this would be the only way I would do this but should to avoid...
**-** I tried to modify everything... thruster, COM, ship position, but looks not this it the way to fix!
**-** Can be Gimbal-lock issue... but according to what I read online it is probably not...
**PLEASE TRY TO HELP ME!**
Give ideas or anything what in your mind. There's a many spaceship game and also airplane games with real physics... someone should to meet with my problem! Very difficult to explain this problem even in my native language, but I hope you can understand what I'm about. If not clear something just let me know!
**THANKS!**
