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

Is there a way to convert screen coordinates to world coordinates ? #90

Open
andnovar opened this issue May 27, 2016 · 7 comments
Open

Comments

@andnovar
Copy link

I was wondering whether AnimatedScene or camera have a way to know the world position once you click on the screen coordinates. Something like this in Unity --> http://docs.unity3d.com/ScriptReference/Camera.ScreenToViewportPoint.html

Thanks in advance

@thothbot
Copy link
Owner

@andnovar
Copy link
Author

Hey thanks for the quick response. I think perhaps it could be convenient to add this to the API to give the camera a ScreenToViewportPoint method.

@andnovar andnovar reopened this May 27, 2016
@andnovar
Copy link
Author

What about if you don't have objects to RayCast or if you want to place it on an empty space ?

@thothbot
Copy link
Owner

Yeah, ok, lets track the enhancement

@thothbot
Copy link
Owner

Yeah, in example sent you this code creates a new cube after mouse click

Mesh voxel = new Mesh( cubeGeo, cubeMaterial );
voxel.getPosition().copy( intersect.point ).add( intersect.face.getNormal() );
voxel.getPosition().divide( 50.0 ).floor().multiply( 50.0 ).add( 25.0 );
scene.add( voxel );

@andnovar
Copy link
Author

Hi Alex, yes,it does but it needs to intersect something. I am working it around creating an invisible plane to intersect with. I am doing like a 3d editor.

@thothbot
Copy link
Owner

yep, it is good idea

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

No branches or pull requests

2 participants