Hello people,
I am pretty new to Unity so go easy on me. I am creating a game with my brother, but since we’re both designers we don’t know a whole bunch about Unity (using version 5.1.something). We are creating a space station similar to the one found in 2001: A Space Oddyssey and need help figuring out the gravity. The gravity should work like on the Halo Rings, so walking on the inside of the outermost ring. Now, I’ve seen a couple of posts about gravity on the outside of a sphere but not much on the inside. Also modifying the world to spin around as the player moves and thus “simulating” gravity will propably not be possible as the world is pretty huge and also there will be quite a lot of physics-affected objects like other characters, water and other stuff inside the ring, which we wouldn’t like to fling off whenever the player moves. We would really appreciate your help in finding a way to get gravity working and are curious to find a solution. A big THANK YOU in advance!
Kind regards,
Dan
maybe get the center point of the ring and every frame get the direction from your center ring point to your character(or whatever object) and apply a force in that direction.
Set your characters up vector to the direction of your character to the center point.
This seems very similar to the way you would do gravity to the outside of a sphere, so maybe I am missing something since you said you already looked that up.
EDIT - I see an issue with doing it the way I stated which is that it will only work if the character is directly on the line of the center point. If you move to the sides then the character will start to tilt.
I’ll try to play around with it to see what I can come up with.
EDIT 2 -
Try this out.
Click for code
using System;
using UnityEngine;
public class GravityPointAxis : MonoBehaviour
{
public Transform gravityPoint;
public float gravityForce = 10f;
Rigidbody myRigidbody;
void Start()
{
myRigidbody = gameObject.GetComponent<Rigidbody>();
myRigidbody.useGravity = false;
}
void FixedUpdate()
{
Vector3 alignedGravityPoint = Vector3.Project(myRigidbody.position - gravityPoint.position, gravityPoint.right); //make sure gravityPoint.right is the direction of the holes of your ring
Vector3 direction = (myRigidbody.position - alignedGravityPoint).normalized;
transform.rotation = Quaternion.FromToRotation(transform.up, -direction) * transform.rotation; //probably want to do this with addtorque or something
myRigidbody.AddForce(direction * gravityForce);
}
}
You can alter it to your needs.
The way it works is, you set a gravity point which would be the center of your ring. Make sure the vector right of the point is the direction of the holes of the ring. This is so we can allow the point to align with the player/object so it is always directly on top of and giving the proper gravity force.
You put this on any object that you want to be affected by the rings gravity. You can do it however you want though, such as at start making a list of all the rigidbody objects and then looping through that list and applying the appropriate gravity.
Now this might work if you are spinning the world if you give the world a physics material with friction on it. You can play around with it.
Otherwise, you are going to have to find a way to determine how much to move in a certain axis based on the rotation of your ring.
Thank you for the quick answer, we’ll try that out! 
This is the same situation we faced in KSP when we implemented planetary rotation… in a way. What you need is to set up your scene to be in a Rotating Reference Frame.
The ring can’t rotate, PhysX only works properly while inside its ‘comfort zone’, where moving objects are movable rigidbodies that collide against each other and against static scenery. A rotating frame solves that by letting you keep your scenery static, and making it look (and feel) like it’s really rotating.
The characters and other physics objects can then move around normally on the inner ring surface. PhysX gravity has to be set to zero (it only works in one linear direction), and centrifugal and coriolis accelerations get applied by script (via AddForce in acceleration mode) to all rigidbodies.
Lastly, the view ‘out the window’ (skybox, objects outside the ring) get rotated in the opposite direction.
This method should enable you to have a ring-station game area, with physically accurate forces, without having to make the whole thing actually spin.
Cheers