# Save & load camera positions

hi guys,

what is the best way to save and load camera positions?
I can save its transform matrices, but then I get distortions when interpolating between different positions.
I can move the camera via its input pins and save those values, but it feels awkward and takes a lot of time.

I want to fly around with the orbit camera, save cam position and target to xml and feed those values into the camera. but how to convert from vector3 to langitude, longitude, length? Polar wont do the trick.

Interesting, I want to achieve exactly the same. I will try and work it out and will share any progress. I am using Dottores orbit cam with a 3dConnexion Space Mouse (which works amazingly well) and would love to save and restore the position.

There is a good article here on how to convert between different coordinate systems.

radius = sqrt(x^2 + y^2 + z^2)
longitude = atan2(y, x)

you can find arcsin on the â€śfunction complex inverseâ€ť node.

ATAN2(y,x) returns the arc tangent of the two numbers x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result. The result is an angle expressed in radians.

arenâ€™t the cameras outputting their position or am I doing something wrong here?

@all how do you guys programm your camera positions? callmenames.v4p (6.4 KB)

iâ€™m not sure but isnâ€™t the order of the transform interpolation important / also the slerp node?

edit: new patch with file reader

CamPos.zip (3.0 KB)

Well, if you are using dottores cam, which I am with some modification, then its real easy. You just save the 4 values of target position, pitch, yaw and distance. Then you would feed the saved values into the marked switches which have the frame delay feedback loop and when you hit the switch the camera would jump to that position. Add a damper and you have smooth movements from one point to the next.

You can use the store node, or better yet if you want to store/read in XML use VL for that.

Hi,
for presets in general in big patches with many parameters this contribution is great Preset Recorder | vvvv. i used for camera presets too like this. save the presets in the iobox then disconnect the input and connect to the setmatrix

It worked well like that in this project ParticleFlowness_Keroxen17 on Vimeo

for more animated cameras,one option is to edit a spline and camera following it.

omg this contribution is so helpful, thanks a lot!

what worked best for me was decomposing (vector3D) the view transform and saving the position and rotation.

but I still canâ€™t get my mind around on how to calculate the camera inputs from its outputs (position & interest). so any thoughts on that would be greatly appreciated =)

@schlonzo: I was looking for this for a while as well and have made this patch. It actually uses the polar node. Not sure why it was not working for you. And Iâ€™m not sure if this is a decent solution or e.g. if this can cause gimbal lock issues.