I'm working on a space simulator and I am currently using the .applyForce() method to move objects. Is it possible to set both a local force (thust) and a global force (3d gravity) to act on an object at the same time? If so, is there a built in function for converting the orientation of a given force?


You can do multiple applyForce() calls per frame, some local, some global and blender works everything out - summing them together to apply a correct total amount of force in the correct direction.


obj = cont.owner
obj.applyForce([0, 0, -9.8], False)  # Global gravity
obj.applyForce([0, 10, 0], True) # Accelearte locally

Or you can do the coordinate conversions manually using the worldOrientation matrix.

| improve this answer | |
  • $\begingroup$ Thanks. Just discovered this accidentally when searching for a work around. Found that while thrusting, the psuedo-gravity I was using was somehow still fully active. This was unexpected, but extremely relieving to find out. $\endgroup$ – Omni Jun 26 '17 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.