Directional Forces


How would I apply a force to an object from a specfic direction, instead of just along it’s axises or the world’s?

use Trigonometry to convert the force into its components along the axises

What? Oh… wait… oh I see what your getting at, Thanks!

I don’t get it, does that mean its impossible?

In the motion actuator just make sure the “L” is unchecked.

In python make sure you pass the local parameter as false, e.g

own.applyForce([fx,fy,fz], 0) # 2nd arg is local

If you want to apply a force with a direction relative to another object some python code such as:

from Mathutils import Vector

FORCE = 10 # magnitude

own = GameLogic.getCurrentController().owner
obj = GameLogic.getCurrentScene().objects['object_name']
vec = own.getVectTo(obj)[1]
vec.magnitude = FORCE
own.applyForce(vec, 0)