I want to specify an the name of an object in a python script, so I can do something like sword.getSensor(“collision”).getHitObjects(), but can I specify the name of an object not linked to the script? (so my character’s arm will stop swining if the sword hits a wall)
thanks for any help in advance (ps, any links to a current list of game engine python commands/descriptions would be greatly appreciated as well)
Why would you need to do that? Can’t you just add a property to the wall object and then specify that property as a filter for the collision sensor on the sword?
Also, what is your “sword” object set to? It has to be set to “GameLogic.getCurrentController()” to work for the getHitObjects() code you have there. That said, I strongly recommend that you use “cont” for the controller assignment from now on. It makes it easier for the python people in the community to recognize what you are doing.
the point of this thread was to find out what to use for the sword-it’s not linked to the script. (I want the arm to stop swinging if the sword hits an object with the property “solid”- there’s more to the setup, I’ll show it when I’m done)