Sonic the hedgehog upside down loop. Stylized Local gravity?

I experimented with the physics briefly… By itself… It does seem possible to have an object with enough velocity to just go through an upside down loop. But the speed seems problematic… It goes through sometimes. I guess this is because once an object goes so fast. It’s calculating the physics on a frame to frame basis and the object passes through before proper collisions can be calculated.

But with that said… To get those speeds the object ends up moving too fast for the player to see what is happening… So what I’m wondering is… If there is a way to do a localized stylized gravity…

if player speed is greater than X… The character will stick to the surface and the model reorient itself based on the normals. Otherwise the player will just falloff or something…

To decide whether you are inside a loop-the-loop, you could just put a big box over the whole construct and use its trigger.

To do your stylized force, figure out if the car is touching the road (ray-cast), and then apply your own custom ‘down-force’.

TBH - I would try a universal custom down-force first, before doing anything too special.


Don’t know if this will work, but it’s an idea to muck around with.

or add a constant force on your player controller… there was a setting in mine there

If you apply a down force will that cause the car to be pushed away from the top of the loop when it gets up there, or drawn towards it?

The car should be drawn towards the top of the loop if your going fast enough, if not, you should start applying “real” gravity again. Also it would be good to check your local rotation to see if your above 90 degrees (to the right side of the loop, assuming your doing a left to right sonic esque movement) to start applying your custom gravity.

Then jumped on the forum the moment it didn’t magically work how you wanted. Thats the problem, physics aren’t something you can be brief with, its all about testing, testing…

Docs are helpful: http://unity3d.com/support/documentation/Components/class-Rigidbody.html

In particular:

In addition to the continuous dynamic flag, play with the mass, more mass will help carry it round the loop.