Orbit view with RealSense and PointCloudViewer

Hi there,
And thanks Cansik for a great library!
I am very new to Processing and programming over all but I am trying to figure out something that is probably super simple for you guys who have been working with it for a while.
I downloaded the latest library for Realsense and the PointCloudViewer was exactly what I needed for my little project. But instead of PeasyCam I would like the view to slowly orbit back and forth automaticly around the Z-axis just like Shiffman does in this video at 6:00 in.(https://www.youtube.com/watch?v=E1eIg54clGo&t=457s).
Do you have any tips for me to get this to work?

2 Likes

@joalca80 Try rotateZ(double) function in Peasycam. For example, this would rotate the Z axis by .01 degree every frame:

double ang = .01D;

cam.rotateZ(ang);

2 Likes

Hi ZvivZ,
Thank you very much for helping me.
I have tried adding ‘double ang = .01D;’ and ‘cam.rotateZ(ang);’ to the code but since I am such a noob on coding I couldn’t get it to work…
The closest I have gotten is to add ‘cam.setYawRotationMode();’ to get it to rotate only around Z axis, but I have to do it manually with the mouse.
I would really like to get it to rotate slowly around Z axis automatically.

1 Like

If you’re able to see the depth point cloud with PointCloudViewer example, just need to add the following line in draw():
cam.rotateZ(.01D);

That should rotate the camera Z axis by .01 degrees per frame. You can, of course, change the argument to whatever amount of rotation per frame you want, or use other code to only rotate during certain events, etc.

1 Like

Moving this coding question to its own thread from the library announcement.

2 Likes

ZviviZ, You are my hero! Thank you so much! =)
It works perfectly now. I realized that it was around Y I wanted it to rotate.
Thanks again!

2 Likes