Camera orbit

Apr 9, 2010 at 7:16 PM

Hi!

This is an amazing project! I searched library like this for a long time.

How can i create "camera orbit" effect using your library?

 

Coordinator
Apr 9, 2010 at 7:42 PM

What do you exactly mean by "camera orbit"? A camera that is rotating around objects?

Basically you will leave the CameraLookAtX - Z fixed at the center (0, 0, 0) and animate the CameraX and CameraZ position using trigonometric functions. You would do something like this in your animation (update) function:

angle += 0.5;
distance = 100;
CameraX = Math.Sin(angle) * distance;
CameraZ = Math.Cos(angle) * distance;
cameraMatrix = Matrix3DFactory.CreateLookAtLH(CameraX, CameraY, CameraZ, CameraLookAtX, CameraLookAtY, CameraLookAtZ);

Check out the sample from the source code  and you will see that I animate the camera's z and y position. If you're not familiar with this 3D transformation concept just experiment a bit with it to see how it works.

 

 

Apr 10, 2010 at 9:35 AM

Ok! Thanks! =)