How to get the mouse location in the canvas in point3d form?
you have to create a behavior which listen to mouseclicking (this.wakeon(new WakeuponAWTEvent(MouseEvent.MouseClicked) has to be written in initialization and processstimulus methods). Then you have to do some casts so that you got a mouseevent. At
the end you only need to use a method provided by the MouseEvent. I think it s something like e.getLocation... or something else. This methods returns a Point with x and y coordinates. Those coordinates you can use to create the Point3f or Point3d. The z coordinate has to set manually. (Choose some value e. g. 0 or 1). You can only determine the x and y coordinate by clicking. But not the z coordinate. Therefore the perspective does not give any chance.
Hope it might help you!
Thanks for you comment.
If I have an object, let's said a box, rotated using mouse mouseratote class, can the method you provided still works if I want to pick the point inside that box, the point it should have before the rotation?
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.