Topdown tank shooter how to::: point at mouse

im gonna have to make this short, have a model of tank, and the top of the tank is suposed to point at my mouse, i want to make it a slow parent, so i have to get another object parented to the mouse first, how do i do that
???

There are various ways to do that. I mostly use an empty wich is always parentet to the mouse.hitObject.
First you need a background plane. This Plane can be used as Hit Object. Make shure it has collision on.
Use a Mouse-over Any Sensor.
mouse = cont.sensors[‘mouse’]
if mouse.hitObject != None:
empty.worldPosition = mouse.hitPosition

now the Empty is always on the Plane at hitPosition.

You can now simply use a track-to actuator to point to this empty.

dont really get it

on the empty i made a mouse-over any sensor
and took the script in,

Heres a picture of my tank
http://i55.tinypic.com/2repibl.png
i want the top part to always point at the mouse ???

sevi_ is right - that is a way to make the top part point to the mouse. Do what he says and have the top part of the tank have a logic brick setup like this:

Always > And > Track To: The empty sevi_ said to make.

Have the empty always run the script sevi_ wrote:


from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
empty = logic.getCurrentScene().objects['Empty']

mouse = cont.sensors['mouse']
if mouse.hitObject != None:
        empty.worldPosition = mouse.hitPosition

thx, now the tracking works, but how do i set a speed limit, so you cant aim too fast?

You can change the time variable on the edit object’s track to actuator. or add a game property outside the script with a variable that can be multiplied with speed set in the script.