I need to create artificial gravity ( like a fake fake centrifugal effect)
I need to create artificial gravity for a space game with a curved ship design similar to the ship from Interstellar , 2001: A Space Odyssey or Passengers. And i would also like it to stop if the ship stops rotating.
I don't know if this is possible if not any tricks to make it look like it is doing this are gratefully appreciated.
Joseph.
Answer by anilhdas · Dec 25, 2016 at 08:32 AM
Adding to @TheDiamondPlay's answer,
You can either switch off the default gravity in the scene, and add force to those objects manually through script (As @TheDiamondPlay has described).
Or you can also leave the default gravity unaltered and add opposition force to stop gravity for those objects which doesn't want to obey gravity (If the number of objects to oppose gravity is low compared to those obeying gravity)
Answer by AurimasBlazulionis · Dec 24, 2016 at 09:06 PM
You need to constantly add force to the objects you want to give that gravity. Use rigidbody.AddForce(Vector3.up * gravity)
.
I haven't watched that movie, but if you need to have the gravity towards the object. You need to do something like rigidbody.AddForce((targetTransform.position, transform.position).normalized * gravity)
where rigidbody is your rigidbody component, targetTransform is the target object transform component.
Your answer
Follow this Question
Related Questions
Moving and Rotating a Player Smoothly on a Rotating Planet 0 Answers
Virtual accelerometer/gyro 0 Answers
Physics for ball on an incline: rolling up a hill if half way up 1 Answer
Non-centered gravity 0 Answers