I’m having a little bit of trouble with the WorlPosition command.
I want save position by pressing a key and then put the object back to the position by pressing another key. But the obj.worldPosition = pos doesn’t work.
Here’s my code
import GameLogic # get the controller controller = GameLogic.getCurrentController() senlist = controller.sensors obj = controller.owner on = senlist["On"] off = senlist["Off"] coll = senlist["Collision"] touche = senlist["Touche"] reg = senlist["reg"] actlist = controller.actuators spin = actlist["Spin"] make = actlist["Make"] if on.positive == True: controller.activate(spin) if off.positive == True: controller.deactivate(spin) if reg.positive == True: pos = obj.worldPosition if touche.positive == True: obj.worldPosition = pos
if I put obj.worldPosition = [ 1.0, 1.0, 2.0] then it workds, but with the variable it doesn’t I don’t understand how to put it.
Also, is there a way of displaying the content of a variable? I’ve tried print(pos) but nothing happens. I don’t know where to look.
In advance thank you for your help.