add/remove properties


is it possible to add/remove a property from an object in real time? for example I don’t want a ray sensor to work if an object is obstructing your view

also, is it possible to probram the ray sensor that comes off of the “mouse over” sensor to use x-ray? that would be great!

thanks for your help!


Instead of worrying about adding and removing the property, why not have a new boolean property (named “clearview” or something) that must be True for the ray sensor to do whatever it’s doing?

For the mouseray thing, I just get the hit position and plug that and the camera position into rayCast()- since the ray can be set to use that vector but cast at any length you want, it works out fine and you get plenty of control.

the easiest way would be to setup bool props, then just tweak in python, ie:

own.variable = ‘true’
blah = own.variable
own.ray = ‘1’
blah2 = own.ray

if blah == ‘true’:
if tooclosetowall.isPositive and blah = ‘true’:
own.variable = ‘false’

Best is to use the Python “del” statement, like this:

del object['property']

or, in a full example:

cont = GameLogic.getCurrentController()

if 'prop' in cont.owner:
	del cont.owner['prop']