- Home /
Artificial Gravity "SpaceShip"
Hello.
What would be the best way to go about adding artificial gravity to a moving spaceship that is rotating around all axis.
at the moment i have disabled the world gravity, parented my character to the ship and applying a down force to keep me grounded and upright, But it is not without its problems like walking on interior walls and such "not intended"
Would it be best to just apply the worlds Physics.gravity to the rotation of the spaceship and use a rigidbody character controller? if so, how could i achieve this effect? "ship rotation = gravity rotation" Thanks.
If anyone has any better ideas or suggestions i would greatly appreciate it, thanks.
ok i managed to get gravity to rotate with my ship so i stick to the ground, 1 problem though, my characters rigidbody pulling down on the spaceships 0 gravity rigidbody i am pulling the ship down with my gravitational force, So i need to reside to an alternative method of doing this, Any ideas would be greatly appreciated, thanks.
Every action has an equal and opposite reaction.
You will need to apply an equal force in the opposite direction for the ship to stay in place. How to do this.. hmm. AddForce(), in the opposite direction of gravity obviously, but how do we know how much force? Perhaps; Physics.gravity* (-1*player.rigidbody.mass)
Answer by wibble82 · Jan 25, 2015 at 10:43 PM
have you considered keeping the ship static, and simply rotating the camera / scenery to give the illusion of motion. I don't know anything about your game so don't know how appropriate that'd be, but it's a common trick to get this type of effect - less worrying about the direction of gravity and the effect of lots of dynamic bodies bouncing around.
Not sure how i would achieve that to be honest, I was told to make a copy of main ship off scene static with my character controller on there while the camera was on the moving ship, The problem is i am using a Floating Origin so every so many units everything gets shifted back when the ship resets to 0,0,0
$$anonymous$$y project so far is beautiful, A full scale solar system for exploration in a Cruise / Light / Hyper-speed ship, So far the engine has kept up with the 1,000,000,000,000 m/s velocity, runs very smooth too, just a few hitches here and there such as this character controller and gravity issue.
I have attempted the "cloned static ship" approach but i just cant get to grips with it, It baffles me as to how i would keep a camera on a moving ship while the rigidbody character is sitting in a fake ship, Could you maybe shine some light? Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613181453im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Constant 3D rotation (torque, angular acceleration, etc) GLOBAL to object in space? 1 Answer
G Force Acceleration 0 Answers
Drift Rotation 1 Answer