# How to calculate centripetal force in BGE?

Everyone knows how a racecar traveling at such-and-such speed can drive along the inner curve of a race course, tilted almost perpendicular to the ground. This is an example of centripetal force. There are a lot of fancy equations here to explain exactly what it is, but they don't relate to my question very well.

My game involves a character who can do pretty much anything that you could do in real life if you were awesome. This includes (but is not limited to) kicking people while airborne, throwing people back-flipping, running at Olympic speeds and punching people through walls.

I want to include a function that allows my character to run on walls, permitting his speed is sufficient. Example of this are found in Mirrors Edge and Jedi Knight 2.

I think this can be probably accomplished by adopting the face normal of a wall, playing an animation (differs from left to right) and decreasing personal gravity, but I haven't been able to get it to work like that. I've looked at these questions:

but they haven't helped.

• It is important to notice that centripetal force is not a force at all, but a manifestation of inertia and momentum. Jun 9, 2015 at 1:35
• conservation of angular momentum, right, but the problem remains. Jun 9, 2015 at 2:18

import bge
cont = bge.logic.getCurrentController()

own = cont.owner

ray = own.rayCast(own.worldPosition+(own.worldOrientation.col[2]*-(actor center from feet distance)),own.worldPosition,'',0,0,0)
if ray[0]:

if own.localLinearVelocity.x>(stick speed):

own.applyForce((0,0,9.8*own.mass),0)

own.applyForce(own.worldOrientation.col[2]*(-own.mass*9.8),0)
own.alignAxisToVect(ray[1],2,.5)