Reading game property data values.

Under the Logic Editor in Blender 2.5 you can set Properties to objects. Is there a way to read these into Python As what they are? Example: I have a property “Oobleck” that I want to read out to a game so that the object behaves a certain way. In this case if you are moving a certain speed I don’t want an object to sink in this surface.

Long story short, I need to read the Game Properties of an object. Thanks in advance.

Any insight on this? I found a few leads that are all undocumented, and was wondering if anyone had an idea. The engine I export this to does not support groups, so I hoped that this would work.

just use the velocity property

here is the script

get the controller

controller = GameLogic.getCurrentController()

get the owner of the controller

own = controller.getOwner()
#print the owners name (so its easy to tell what the numbers are in the blender protmpt)
print own
#get the velocity of the owner
velo = own.getVelocity()[0]
print velo
if velo > 1:
print “hello world”

code ext.

i set a velocity for my object
here is what this code outputs

3.99828505516 (the velocity of the object)
hello world (because that velocity was greater that 1)

oh and make sure you tab in [print “hello world”] or it won’t work

hope this helps

It would have helped, if that was the end result. The engine I am throwing this into requires certain tags so that things behave a certain way. If I were just building one world than I would program it like this, but the intent is to build something modular, and doing it that way would not work.

The custom properties are going to be used as tags to export this into some custom xml that is latched onto a file with these objects because the method of export strips the objects of these values. So I need to be able to write these values. Thanks for the reply, though.

import bpy
props = bpy.context.scene.objects['MyObject']

Thank you, this is exactly what I was looking for.