Object position python.

Hey,

I’ve parented a Object (in this case a Camera) to another object. With a python script i’m turning the camera around. Does anyone know how I can read the camera position, and then later turn it back on that spot? So that the Camera moves back to the original position.

Thanks ^^

Attachments

Camera test.blend (875 KB)

hi

in the blend i attached you can see a working demonstration.

press the W key to move and the S key to stop.
if you want to rotate the object just switch the o.position to o.localOrientation and it should be working using the rotation

greetings
manarius

Attachments

positionreset.blend (421 KB)

Hey, Thanks a lot. =]

Do you know why it doesn’t work when I change the moveend from a keypress to a “always” sensor without True level triggering (pulse mode).

Or just write it in the beginning of the script…?

Btw, do you also know it for rotation? xD

I added my file. Can someone check why it isn’t working plz?

Press Space and next R

which blender version are you using=?

if you use 2.49 you should uncheck the game->ignore deprecation warnings and make them vanish (the console gives you all the informations you need for that)

to use the rotation instead of the position just exchange the o.position in the script with o.localOrientation and make the objects actuator rotate the object instead of moving it.

i looked at your file and you attached the script on the cam. dont know if you intended this, but i recommend you to create three properties in the cam, named x, y and z and press the little button labeled D to debug them. that way you will at least see, how the values change.

hope i could support you
greetings
manarius

Damn. Reloaded newest attachement… I added the script to the camera pivot. as you can see… But when I press W the pivot somehow becomes an Float object so that the rotating script doesn’t work anymore. :frowning:

Rotating is with mouse button and mouse.