Previous Thread  Next Thread

chat icon Problems affecting a force actuator with Python (newbie)

Bradtothebone

Posted: Sat Jan 11, 2003 12:43 am
Joined: 10 Jan 2003
Posts: 3
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:

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

force.setTorque(torqx,torqy,torqz,torql)

print"!"


It's going to get a bit more complicated, but for now I just need to actually control the torque..so..what 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.
Reply with quote


d0pamine

Posted: Tue Jan 14, 2003 9:05 pm
Joined: 16 Oct 2002
Posts: 29
Hi,

Might want to post these types of questions at elysiun.com, 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:
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.

Cheers,
Tom
Reply with quote


Bradtothebone

Posted: Wed Jan 15, 2003 1:37 am
Joined: 10 Jan 2003
Posts: 3
Awsome, thanks a lot! .. and sorry about posting in the wrong place.
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group