I’m trying a 3d visualization and would like to write code to control the view position & angle, and render individual frames that I can assemble into a movie. I expected something like the following to work:
An Axis3 is not meant to be rotated around by manipulating the camera, it has azimuth and elevation properties for that. It is also not a free-view axis, because it was made to always fit into the rectangle it occupies in the layout. So usually you would use a standalone Scene or an LScene put into a layout of a Figure to get a free camera.
I’m not a 100% sure how to change that scene’s camera correctly, though.
For 3D axes are you sure update_cam! takes a tuple ? It seems it can take another camera, or update_cam!(scene::Scene, eyeposition, lookat, up = Vec3f(0, 0, 1))
Just for completeness, here is a little MWE that shows how to access the camera:
using GLMakie
fig, lscene, plot_obj = meshscatter(rand(Point3f, 10))
# if you want to directly access the camera:
cam3d = Makie.cameracontrols(lscene)
# API with a bit more of convenience:
zoom!(lscene.scene, 1.05)
rotate_cam!(lscene.scene, Vec3f(0, 0, 0.2))
translate_cam!(lscene.scene, Vec3f(0, 0, 1))
The drawback off the free-view axis using Scene is that it doesn’t look good from all angles. But we could in principle improve it as well I think (it’s a very old piece of code so it hasn’t made use of a lot of features we added in the meantime that could help).
It is also not a free-view axis, because it was made to always fit into the rectangle it occupies in the layout.
That’s what I tried to convey, you cannot zoom in because then all the axis decorations would break. In my mind you can’t really have both? Full freedom of camera movement and nice axis that behaves well in a layout that is.
Also, the viewmode :stretch fills the rectangle the most, but it ignores axis aspects.
One other obstacle I’ve noticed is that record doesn’t seem to follow cam3d.eyeposition[] = newpos updates that occur in the do-block. display(fig) or display(lscene) doesn’t seem to fix it. However, outside of record those take the intended effect.
cam.eyeposition etc aren’t directly connected to updates of the camera matrices. You have to call update_cam!(scene, cam) for that (or update_cam(scene, cam, eyeposition, lookat[, up])).