1
$\begingroup$

I am no beginner of blender and python but I have a problem and therefore a question which couldn't be solved with help from all other internet pages.

My problem:


I have put one object in another layer to be duplicated several times by scene.addObject(). The duplicates show up in another layer perfectly. I have one object checking for collisions. The duplicates are 'spawning' on the object which is checking for collisions and my created dictionary-variable will be the .hitObject of the collision checking object. For example: one object is called "a". As soon as "a" hits the collision checking object the variable will also be "a". "a" is also full of properties which I can access by calling this my variable and then look for property. When my collision object is "b", I will get access to properties in object "b". So the line:

If ( for collison checking object).positive:
Dict[variable]=(for collsion checking object).hitObject
variable=Scene.objects[str(variable)] #so is object is "a" i call a=Scene.objects["a"]
variable["property"]+=5 

To change the property of whatever object comes on my collision checking object. But now I have made another collision checking object with the same code but "variable" changed so it will manipulate every objects property which comes onto my second collision checking object.

So variable will change only what comes onto collision checking object1 And variable2 will change only what comes onto collision checking object2

But variable name turns out to be the same as variable2 because when duplicating the objects they will have the exact same name. And so on if I call to change property of variable2 object, variable objects property will change as well. And I don't want that to happen. So is there any kind of trick to have unique things so I can only change variable2 if I only want to change variable2?

All the other methods I've seen let you change property and based on that have a "unique" system. I know how to check for property in "variable2" object. But that isn't going to let me change other variables.

How can I solve this problem?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.