0
$\begingroup$

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?

$\endgroup$

1 Answer 1

1
$\begingroup$

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.

Example:

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.

$\endgroup$
1
  • $\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, 2017 at 9:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .