Hi, i want to move an object in a walkthorough, the user moves the camera with the keyboard and when he clicks an object he “catches” it and the object moves parented with the camera, i used an Empty to do this.
This are the sensors:
a Left Button Click sensor = “senso”
a Mouse Over sensor =“senso1”
another Left Button Click sensor = “sensor1”
2 properties: moved and click, to set that the user clicked the object and moved it, inicialized = 0
I’m using “senso” for catching the object and “sensor1” for droping it,
linked to this script:
from Rasterizer import showMouse
import GameLogic
cont = GameLogic.getCurrentController()
own = cont.getOwner()
showMouse(1)
scene = GameLogic.getCurrentScene()
senso = cont.getSensor("senso")
senso1 = cont.getSensor("senso1")
sensor1 = cont.getSensor("sensor1")
if senso.isPositive() and senso1.isPositive():
own.cli = 1
object = scene.getObjectList()
for o in object:
if (o.name == "OBEmpty1") and (own.cli==1):
pos = o.getPosition()
ori = o.getOrientation()
own.setPosition(pos)
own.movi = 1
if (own.movi) and (senso1.isPositive()) and (sensor1.isPositive()):
own.setPosition([1.5,2.28,0.932])
It reaches the last sentence and it kind of position the object but it returns to the Empty position, i think i need some way to “break the link” between the Empty and the object but i don’t know how