Is there an attribute to check if an actuator is active?
I tried:
mot = cont.actuators["mot"]
mot.positive #nope
mot.active #nope
mot.activated #nope
Is there an attribute to check if an actuator is active?
I tried:
mot = cont.actuators["mot"]
mot.positive #nope
mot.active #nope
mot.activated #nope
actu = cont.actuators['plopper']
if actu.positive:
#do stuff
#edit actually its for sensors.
you can use the actuator sensor to check if a actuator is positive
yes i know the actuator sensor, but i would want a way in python
what kind of actuator?
could you set a value when activating and deactivating ?
a motion actuator, i change
mot.dLoc = [0,0.1,0]
and something like that
edit:
yes i do change a property and currently thats what i’m doing, but with a check if it was active it would be easier
you can use a property sensor to monitoring the changes then
Why you would need that?
In pure Python, the first thing that comes to mind is to set a boolean whenever you call bge.logic.getCurrentController().activate(“actuator-name”)
As far as I can tell, there is no other way other than simply knowing that it was activated ahead of time somewhere else in your code…You could maybe also check the sensor that activates it too (via the bge.logic.getCurrentController().sensors[“sensor-name”].positive attribute), which may be work in many cases.
Just to hazard a guess, you’re probably like me: veteran Python / new to BGE, so I’ll just quickly say: You’re going to have to make some painful compromises between logic bricks and code, and really think outside the box when putting the two together to solve problems in your game…
BGE is pure awesomesauce, though and well worth the tradeoffs, for many of my ideas that are coming to life now…Good luck!