[Bf-funboard] bge proposal : having python scripts for sensors, (controllers) and actuators

Jonathan-David SCHRODER myselfhimself at free.fr
Tue Sep 16 00:37:54 CEST 2008


Hi
I was just thinking about this case :
if you want to make a process such as : "when thing1 and thing2 happen
together then do stuff"
Sensors : here you see thing1 and thing2 should/could be sensors being
triggered
Controller : happen together : use an AND
Actuator : the do stuff action

imagine either thing1 or thing2 are complex  of events (ex : some cow is red
and its got an altitude like this)...
then the way to have those complex events trigger an action doesn't not
really come from the Sensors section...
What I'd do in such a case would be to have an always sensor with true
pulse, connected to a Python controller,
which would in turn see if the events happen and : either trigger some
action, or set some property somewhere so that
this somewhere object, thanks to a Property sensor, acts in some way !

So... 1) having complex sensors is not easy to do.

2) The same cannot be said for complex controllers, because there's a
possibility to have a python script there.

Now, imagine this case :
you have a car (or plane) with several gears. To make the car go at some
speed defined by its current gear, you'd need (when the user presses the
accelerate/gases key):
Sensors : keyboard with true pulse maybe
Controller : a python script which controls the Actuator (value to apply =
gear*someConstant for instance)
Actuator : a motion actuator (ex : servo, linv or force)

Same thing here, we're building a kind of special actuator which always
depends on the car's gear value.
So there could be a python script here with this kind of code :
mA = (new instance of) MotionActuator(details here namely with a
thisObject.currentGear*someConstant expression)
thisObject.addActiveActuator(mA,1)
(.... or something less memory consuming or more practical...)

My final proposal is :
1) make sensors able to be scripts
2) controllers are scriptable this is ok
3) make actuators able to be scripts

What do you think ?

Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-funboard/attachments/20080916/fbb844f4/attachment.htm 


More information about the Bf-funboard mailing list