Skip to content

Instantly share code, notes, and snippets.

@satishgoda
Created May 31, 2013 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satishgoda/5684127 to your computer and use it in GitHub Desktop.
Save satishgoda/5684127 to your computer and use it in GitHub Desktop.
import bge
controller = bge.logic.getCurrentController()
owner = controller.owner
print(type(owner))
print(owner.getPropertyNames())
for prop in owner.getPropertyNames():
value = owner.get(prop)
prop_type = type(value).__name__
print('{0} -> {1} ({2})'.format(prop, value, prop_type))
print([owner.get(prop, None) for prop in ('prop1', 'undef', 'prop2')])
Blender Game Engine Started
<class 'KX_GameObject'>
['prop1', 'prop2']
prop1 -> Hello (str)
prop2 -> 0 (int)
['Hello', None, 0]
Blender Game Engine Finished
['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'actuators', 'alignAxisToVect', 'angularVelocity', 'applyForce', 'applyImpulse', 'applyMovement', 'applyRotation', 'applyTorque', 'attrDict', 'children', 'childrenRecursive', 'color', 'controllers', 'disableRigidBody', 'enableRigidBody', 'endObject', 'get', 'getActionFrame', 'getAngularVelocity', 'getAxisVect', 'getDistanceTo', 'getLinearVelocity', 'getPhysicsId', 'getPropertyNames', 'getReactionForce', 'getVectTo', 'getVelocity', 'groupMembers', 'groupObject', 'invalid', 'isPlayingAction', 'life', 'linVelocityMax', 'linVelocityMin', 'linearVelocity', 'localAngularVelocity', 'localInertia', 'localLinearVelocity', 'localOrientation', 'localPosition', 'localScale', 'localTransform', 'mass', 'meshes', 'name', 'occlusion', 'orientation', 'parent', 'playAction', 'position', 'rayCast', 'rayCastTo', 'reinstancePhysicsMesh', 'removeParent', 'replaceMesh', 'restoreDynamics', 'scaling', 'scene', 'sendMessage', 'sensors', 'setActionFrame', 'setAngularVelocity', 'setCollisionMargin', 'setLinearVelocity', 'setOcclusion', 'setParent', 'setVisible', 'state', 'stopAction', 'suspendDynamics', 'timeOffset', 'visible', 'worldAngularVelocity', 'worldLinearVelocity', 'worldOrientation', 'worldPosition', 'worldScale', 'worldTransform']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment