# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Newcomers DBPro Corner / [DBP] - rotate camera around an object

Message
Posted: 16th Sep 2013 16:32
Hi

is there any way to make a camera to rotate in a cirkel around an object?? i can only get the camera to stand still an rotate i need it move in a cirkel instead.

thx
Posted: 16th Sep 2013 19:05
Ghost Games - This is the wrong board, go over to the DBP Newcomers board...

It is very simple but depends on what you wish to achieve exactly...

Posted: 16th Sep 2013 19:12 Edited at: 16th Sep 2013 19:14
@Ghost Games
wrong section ...you had better post it in newcomer Dbpro corners.
I'm not completly sure what your need , could be something like this ??

Edited. I jumped the gun again answering without being sure some one did....Sorry Mr Valentine.
Cheers.

I'm not a grumpy grandpa
Posted: 18th Sep 2013 11:10
Maybe something like this:

Function Orbit_Cam(obj,ang#,range#)
position camera object position x(obj),object position y(obj),object position z(obj)
rotate camera 0,ang#,0
move camera -range#
Endfunction

I will move this thread to the newcommer section tonight, may as well give it a little while, so the originator has time to see it.

I am the one who knocks...
Posted: 20th Sep 2013 09:18
Quote: "cirkel"

As for the question:

pretty much use Van B's function (paste it in the bottom of your code) then call it from a loop like this:

do
inc angle
Orbit_Cam(1,angle,10)
sync
loop

this would cause the camera to spin around an object quickly.
Posted: 20th Sep 2013 17:56
If you don't need to orbit around the object in all 3 dimensions and the rotation stays on a non-rotated plane along the y-axis, then you can use this function so that the camera continues to point at your object as it moves.

If your orbit does indeed tilt off the axis', then it can still be done but requires a more complex rotation algorithm.

Posted: 21st Sep 2013 07:17 Edited at: 21st Sep 2013 07:28
This will get you orbiting in all 3 dimensions, and is controllable by the mouse. This could be changed to an automatic orbit pretty easily by passing in new tilt and pan values as parameters to the function and removing the mouse block.