Thoughts and tutorials on programming

Monday, October 30, 2006

Random Blender notes

Blender Game Engine notes:

import GameLogic
GameLogic.myVar = 3

liveScene = GameLogic.getCurrentScene()
obj = liveScene.getObjectList()["OBCube"]

With the game engine, there seems to be no way to have a script that is fired with two actuators -- i.e. if this AND this then fire this script. Doesn't work. One way around this would be to revamp the GUI system to have another "column" that is logic connectors. like "add a logic connector "AND" or what not. Then you could use those with the normals and with these.

constraints are NOT reflected at 'game time' in the GameEngine. Parent/child objects are.

right now if you restart a scene, it reruns all scripts that have the "quotes" both unchecked (which hmakes them 'init' scripts).
Ways to instantiate 'once' in the GameEngine:

with solid variables:

print == ""
except AttributeError: = "init value"
print "done"

# the above way just makes it possible to not have the script crash, as it would typically do if you checked if the variable bbc existed or had been instantiated.

--there may be others.

Note IPO's for the GameEngine are by frame count, not by frame, so if you have a faster or slower out.

Also it would be nice to have more flexible IPO actuators--i.e. they can change IPO (the name) within the one object (the IPO referring to that object), and another would be then that more objects could use more than one IPO.

That's my notes so far!


Roger Pack said...

also you CAN access properties from arbitrary (existing in current scene, current layer) objects thus:
liveScene = GameLogic.getCurrentScene()
obj = liveScene.getObjectList()["OB" + realObjectName]
obj.propertyname = 3 # re-assign that bad boy -- works!

Roger Pack said... appears that blender objects do not start to re-act (run scripts, etc.) until they are created. So to have them work at startup they must be part of the current scene and visible via selected layers (if in a non visible layer, also not being processed). I think :-)