Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting help on camera positioning #310

Open
mimooh opened this issue Mar 19, 2019 · 3 comments
Open

Getting help on camera positioning #310

mimooh opened this issue Mar 19, 2019 · 3 comments

Comments

@mimooh
Copy link

mimooh commented Mar 19, 2019

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.

@SoulDesignerTom
Copy link

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
Copy link

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 :)

@mhoelzner
Copy link
Contributor

mhoelzner commented Sep 26, 2020

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants