简体   繁体   中英

How to interact with Java3D elements using mouse?

I want the user to be able to change the length of a cylinder by clicking-and-dragging his mouse. How should I start on this ? Any form of help would be great.

Check out the example code here . The basic idea is:

  • Use mousePressed() listener to detect a mouse press.
  • Use Java3D picking API to detect if mouse press intersected shape.
  • Use mouseDragged() listener to detect amount of change and update your shape accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM