Magnetic Race Track? How to stick to a tubular track?

So in F-Zero which is what my game is based on, you go around these ‘tubular’ race tracks, like this:

(0:53)

You can freely race around the cylinder, whether it be from the top, sides, or bottom and you totally stick to it like a magnet. Of course it’s hovercars that hover slightly above the track, but still.

I’ve tried to recreate that with the cylinder GameObject in Unity, and scripts.

Most scripts I’ve tried were seen in this thread: http://forum.unity3d.com/threads/how-in-the-world-were-the-physics-in-f-zero-x-done.204747/

I’ve also browsed unity answers forever, this has been getting me for days since I need to figure out a reliable way that works with any type of gameobject, any type of car and isn’t buggy as heck. I’ve even tried to combine various scripts.

if you were dead-set on using physics,…

i would test:

  • turning gravity off on objects and relying only on forces (like being in space… zero ‘g’).
  • apply a directional force from the bottom of the ‘hover craft’ toward the surface normal of the track (tube)
  • use a ‘forward’ force on the hover craft to propel the object in that direction

you may also look at using physics joints between the hover craft and an empty gameobject that sticks to the surface of the track… so if players are hit hard enough, it breaks and they go careening off … just some thoughts, but I think this could be done with physics alone.

like you said, like a magnet… gravitational forces are weaker compared to magnetic… so turn them off, and just use the idea of forces to control stuff.