Track to mouse

hi guys, i have been playing Freelancer for a quite time, and i have been wondering something, as i see, the turrets in the ships track to the mouse like in this video: at 2:34, the turrets in the cruiser tracks the mouse, is there a way to do this in the BGE?, please help!, and if you can, leave an example file :smiley:

no one can help me? :frowning:

usually you add an empty at the position where the mouse points to (Mouse over). Make the ship track the empty.

I hope it helps

i have a question, how would you get the empty to know where the mouse is pointing?

If I could figure up how to upload a file I already have one for you

Here’s the code

g = GameLogic
c = g.getCurrentController()
o = c.getOwner()
objList = g.getCurrentScene().getObjectList()
track = objList[“OBtrack”]

mouse = c.getSensor(“sensor1”)
pos = mouse.getHitPosition()

@AndreVega: you can attach a blend to your post :slight_smile:

@Socker: There are multiple ways of doing that. One is what AndreVega is showing you. Beside that, there are multiple threads regarding the same question. They came up with different solutions.

I still can’t get it to work