xeogl icon indicating copy to clipboard operation
xeogl copied to clipboard

Getting help on camera positioning

Open mimooh opened this issue 6 years ago • 3 comments

Hi, awesome lib. Seems faster than threejs for basic buliding models. Perhaps it's not the right place, but since I cannot find any forum: what would be the procedure (if it's possible) to achieve this: Say I have a cube. Find the position for the ortho camera, so that the rendered image is say 30x30 pixels square (camera looking at my cube from the top, displaying a single face of the cube, rendered at the size given). I am not asking for the code if that's not quick one, just for the idea.

mimooh avatar Mar 19 '19 15:03 mimooh

I would like to second that. I'm trying to move camera along CameraAnimationPath - but with no success - it's almost impossible to guess the numbers for settings. It took me long time just to position static camera in the scene the way i wanted. But for animation? How can i do this? Maybe some generator or some way i can mesure that? I was already trying to getCameraMatrix to identify current camera position - but i don't really get the array... maybe i'm to dumb for it.

Anyhow - the plugin is great i believe it will beat three.js - much better performance.

SoulDesignerTom avatar Sep 25 '20 21:09 SoulDesignerTom

Ok i'll find a way for that. Just add to your script:

camera.on("matrix", function(matrix) { console.log(camera.eye); console.log(camera.look); console.log(camera.up); });

Then when you set your camera with mouse you will get parameters for all those variables :)

SoulDesignerTom avatar Sep 25 '20 22:09 SoulDesignerTom

I use this function to get the current camera position

function _getCameraPos() {
        return {
            eye: [..._camera.eye],
            look: [..._camera.look],
            up: [..._camera.up],
        };
    }

where _camera = scene.camera;

mhoelzner avatar Sep 26 '20 18:09 mhoelzner