First-Person Hollow Sphere World

Hello,

I’m trying to create a ‘simple’ game inside a sphere, so the player can look around and change her walking direction with the mouse and move with the horizontal and vertical control axes. I seem to have succeeded in creating the sphere itself by modelling it in Maya with the normals reversed, importing it into Unity with “Generate Collider” checked and NOT checking ‘convex’ on the mesh collider - in normal gravity and with a normal controller, I can walk around in the bottom half like a basin.

The problem is getting a good character controller that works with an appropriate gravity script. I’ve done a lot of searching and found some similar topics. This one offers a gravity script, but the poster says that the Unity character controller, which would otherwise be a great set-up for what I want, is not rotatable: [SOLVED] Player Rigidbody Walking Around Planet - Unity Engine - Unity Discussions

This topic contains (at the very end) the same gravity script a and a 3rd person walker script for walking on the outside of the planet, but when I attach them to the Unity RigidbodyFPS controller, I can’t move, maybe because it’s the wrong perspective: [SOLVED] Player Rigidbody Walking Around Planet - Unity Engine - Unity Discussions

Please let me know if you have any tools to help me solve this. As you can see, I’m a beginner. I’ve been doing Unity/C# tutorials for a couple of months and want to try actually making something, but this hollow sphere idea is giving me a hard time.

Thanks in advance.

I am not sure, but possibly you should make the sphere to rotate so the fps controller would always stay at the bottom of the sphere.

Is this more what you had in mind? I found this cool asset for you:

Hey, thanks for your replies. @tomekkie I tried that, though the problem was setting up the controls. The point of orientation is the player, but when you rotate the sphere along one axis, it changes the direction of its other axes, so the controls affect it differently.

Someone else gave me the idea to attach the player to an object in the middle of the sphere and rotate said object. This is working well.

Just wondering - means the player doesn’t stay vertical?
Are you still using the Unity character controller?

No, the Unity Assets Character Controllers are very complex and conceived for regular gravity, so I made a new script (borrowing a lot from the Unity scripts, e.g. the functions for locking range when looking around with the mouse), attached it to the parent object in the center of the sphere, which has as children the player rigidbody and camera.

So what happens if your player encounters an obstacle or an upward or downward slope over the spherical base surface - or you just simply didn’t need support for anything like that.

Because there’s a rigidbody attached to the player, obstacles should still stop him. I don’t (yet) plan on having any slopes, but it’s a good question. It’s been suggested to me that, if I want to allow the player to jump, I could implement a SpringJoint component. This might work with slopes too, but I haven’t learned how to use it yet.

Possibly the simplest could be to cast a ray from the player position to your spherical terrain and then correct the player position along the radius to ensure it stays within some given range.

OK, thanks. I’ve only been exposed to RayCasting in the Survival Shooter tutorial, so I’m not exactly proficient… but if/when I need to try another approach, I’ll look up a RayCasting tutorial and get back to you.