- Home /
Newtonian physics in a space game
Hello, I am developing a Sandbox/Space adventure game. But i want the player to be able to get in his Spacesuit and leave his station. However as of now i dont know how to write a script that would change the behavior of the player when he leaves the Station (Inside the station is gravity). How would i do that? Any ideas?
Thanks in advance.
I would set gravity to 0, 0, 0 and let the player move on y axis as he wants. It's just "my tip"
But how do i make him move in the direction the mouse points? if i set gravity to 0 he still moves as he is on a platform he is just not falling. And also how do i make it so he doesnt stop after releasing the key for movement(just like it would be in space if you apply force to a body and nothing works against it it wont stop)
Example for moving forward: transform.Translate(Vector3.forward * Time.deltaTime, Camera); I don't know how to do 2nd thing but i guess it's something similar to sliding.
Add a rigidbody component
Turn off gravity
$$anonymous$$ake sure 'Drag' is set to 0
$$anonymous$$ake sure 'AngularDrag' is set to 0
In your script use Rigidbody.AddForce() to move your object
Answer by HappyMoo · Jan 07, 2014 at 08:13 PM
Turn gravity off on the rigidBody... useGravity=false
and use addForce whenever he turns on his spaceshuit boosters or throws something away or pushes himself away from something.
Also make sure you put the right mass on the rigidbody etc...
Your answer
Follow this Question
Related Questions
Drift Rotation 1 Answer
Newtonian Gravity 2 Answers
How do you create a continuous physics simulation in Unity? 1 Answer
Gravity y is stronger than x 0 Answers