0
\$\begingroup\$

I am exploring raylib and am trying to create a 3d isometric map of cubes. Normally this is done by setting the camera to isometric with an angle x of 30 and angle y of 45 (sometimes it is angle x of -30 and angle y of 45).

I am not sure how to set the angle of the camera, I see there is an up vector, but its values seem to be limited to smaller values than 30 or 45. With this camera setup It appears to be isometric, though I'm not sure why.

Camera camera = {0};
camera.position = (Vector3){10.0f, 7.5f, 10.0f}; // Camera position
camera.target = (Vector3){0.0f, 0.0f, 0.0f};     // Camera looking at point
camera.up = (Vector3){0.0f, 1.0f, 0.0f};         // Camera up vector (rotation towards target)
camera.fovy = 10.0f;                             // Camera field-of-view Y
camera.type = CAMERA_ORTHOGRAPHIC;               // Camera mode type

This has the cube at position 0, 0, 0 at the top of the screen. This picture illustrates what I am seeing approximately:

enter image description here

If I change the position of the camera to:

camera.position = (Vector3){-10.0f, 7.5f, -10.0f}; // Camera position

Then I appromxiately see this:

enter image description here

Although it appears much higher on the screen. How do I go about rotating the camera from the first picture to the second picture? Also, how do I rotate the block at 0, 0, 0 to any other corner if the map has an even number of rows, columns?

I should add that simply tweening from 10, 7.5, 10 to -10, 7.5, -10 eventually does get to the second picture, but it inverts the map first (looks very strange), I want a circular rotation towards the second picture. The Orbital camera mode almost does what I want, but it seems move the map as well.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.