Camera return to location

Hi,
I have a simple problem.

I want my camera to return to the same location when I let go of the keyboard.

Basically, when I hold down a direction button, the camera should go to that direction. However when I let go off the button it should return to the original position. How do I make it return?
Thanks.

I’m not sure if this is exactly what you’re looking for, but you could do it with a python script:

import GameLogic as GL
cont = GL.getCurrentController()
own = cont.owner   # = the camera

W = cont.sensors["W"]   # get the sensor named "W"

if W.getKeyStatus(W.key) == 1:    # if W is just pressed
    own["originalPos"] = own.worldPosition   # save the position in a property of the camera
    
if W.positive:
    #     Movement, for example:
    own.applyMovement([0.0,0.2,0.0],1)
    
if W.getKeyStatus(W.key) == 3:   # if W just released
    own.worldPosition = own["originalPos"]

Connect a keyboard sensor with true level triggering (in my example W) to the script on the camera.
Here’s some info on the method getKeyStatus() I’m using.

I was a little bit slower Jay-D. I made also an example but only more with Logic Briks less Python.

HG1

Attachments

SetCamPos.blend (131 KB)