# Orbit view with RealSense and PointCloudViewer

**URL:** https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354
**Category:** Libraries
**Created:** [February 29, 2020, 9:52am UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354 "2020-02-29T09:52:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![joalca80](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@joalca80](https://discourse.processing.org/u/joalca80)
#### Post date: [February 9, 2020, 4:02pm UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/1 "2020-02-09T16:02:46Z")

</div>

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](https://www.youtube.com/watch?v=E1eIg54clGo&t=457s)).  
Do you have any tips for me to get this to work?

---

<div class="post-metadata">

### Author: ![ZvivZ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/zvivz/32/8176_2.png) [@ZvivZ](https://discourse.processing.org/u/ZvivZ)
#### Post date: [February 19, 2020, 5:27pm UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/2 "2020-02-19T17:27:01Z")

</div>

@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);

---

<div class="post-metadata">

### Author: ![joalca80](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@joalca80](https://discourse.processing.org/u/joalca80)
#### Post date: [February 29, 2020, 9:52am UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/3 "2020-02-29T09:52:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ZvivZ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/zvivz/32/8176_2.png) [@ZvivZ](https://discourse.processing.org/u/ZvivZ)
#### Post date: [March 3, 2020, 5:56pm UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/4 "2020-03-03T17:56:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 3, 2020, 6:31pm UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/5 "2020-03-03T18:31:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![joalca80](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@joalca80](https://discourse.processing.org/u/joalca80)
#### Post date: [March 3, 2020, 7:38pm UTC](https://discourse.processing.org/t/orbit-view-with-realsense-and-pointcloudviewer/18354/6 "2020-03-03T19:38:22Z")

</div>

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!
