Hello community,
I want to create something like a sphere or winded tube where you actually can walk on the inside. I already got to the point to always have the character be rotated correctly via RaycastHit but how would I go for to align the character exactly to the wall so he walks at the wall and is not somewhere floating in the air?
Thanks in advance, already helped me so much
Is the character the only thing that needs to be affected by gravity? Or are their other items as well that need to be affected by this outward “gravity”?
Other than that only the AI would be affected by the gravity so setting the global option is not a solution.
I would suppose a sphere would be easy… I wrote a reponse back to someone where they wanted to walk on the outside of the sphere, it would be easy to manipulate it in reverse…
http://forum.unity3d.com/threads/66606-Player-walks-around-a-sphere-and-doesn-t-fall-off.-HOW-…-Snake-3d…-antigravity?highlight=mario+world
A cylinder would be a little more complicated.
I think you already did the hard part with the RayCast. Turn off (0) the default physics gravity and apply a force on each character in the direction that you found in the RayCast.
Just find the height of the character and divide by 2.
This depends on the collider and the character but you can use Collider.bounds to get where exactly to offset the gameObject so the edge rests on the floor.
S once you have the point, you use the UpVector * half the height of the collider/mesh
I have the feeling I’m kinda dumb. I don’t know but here’s what I’m trying to do (forgive me for the crappy drawing)
So what I’m aiming for is a character which sticks to the walls, can only move forward and can’t rotate, just strafe. The whole thing is a closed cylinder with curves etc… Here’s what I currently have but it’s not really done: http://sargodarya.de/sample/ (UpArrow to accelerate)
I don’t know if I’m just stupid or if this really is such a big deal, some hints how I could do this?
nice is like f-zero -x i wanted to do one like this but it was so difficult
I’m sure you can do it with the built-in physics, but it might be simpler just to write your own simplified physics.
Have the visible character parented to an empty game object in the center of the tube, which you can use as a pivot point. Then rotate the pivot object to strafe.
Alternately, have the character stay in place and rotate the cylinder world around them.