Script not working


I tried this script today, which I found on some page:

controller = GameLogic.getCurrentController()
owner = controller.getOwner()

That script is supposed to change the collision margin in game physics, but it didn’t work. There was an error message in the console:
NameError: ‘GameLogic’ is not defined

How to fix it?

Regards, Ceox

You need to have the python GameLogic module loaded…

try adding a line at the top

import GameLogic

at the top of the script…

Thanks, but there’s still an error: ImportError: No module named GameLogic

How are you running the script?
It won’t run from the text editor, GameLogic is only accessed from the game

It should be attached to a “controller” logic brick and will activate when you run the game
(with a sensor feeding in of course)

How does that happen?
and yes I used the text-editor…