Problems affecting a force actuator with Python (newbie)

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Fri Jan 10, 2003 11:56 pm

Problems affecting a force actuator with Python (newbie)

Post by Bradtothebone » Sat Jan 11, 2003 12:43 am

I'd like to be able to vary the forces (the Torque specifically) that a certain motion actuator creates in real time, but I'm having some problems.

My script is basically this:

Code: Select all

from GameLogic import *

cont = getCurrentController()
ow = cont.getOwner

senslist = cont.getSensors()
actlist = cont.getActuators

mousesensor = senslist[0]
force = actlist[0]

torqx = 10
torqy = 10
torqz = 0
torql = 2


It's going to get a bit more complicated, but for now I just need to actually control the I don't understand is that I don't get any errors, and the script prints the exclamation mark just fine. It's probably something pretty dumb. I'm pretty experienced with blender, but I'm a total newbie when it comes to python and scripting in general. So if somebody could give me a hand and tell me what I'm doing wrong, or even just show me a better way of setting Torque forces (or indeed any forces - the script doesn't work for any of them) I'd be grateful.

Posts: 28
Joined: Wed Oct 16, 2002 9:47 pm

addActiveActuator needs to be called

Post by d0pamine » Tue Jan 14, 2003 9:05 pm


Might want to post these types of questions at, more for using blender rather than development of blender discussed here.

After you set the torques, just add a call to the GameLogic method

Code: Select all

addActiveActuator(force, 1)

This may not be the right syntax or even exact method name, but you get the hint. The function adds this actuator to the list of actuators to be "evaluated" this frame cycle.


Posts: 0
Joined: Fri Jan 10, 2003 11:56 pm

Post by Bradtothebone » Wed Jan 15, 2003 1:37 am

Awsome, thanks a lot! .. and sorry about posting in the wrong place.

Post Reply