| View previous topic :: View next topic |
| Author |
Message |
aleksandar Guest
|
Posted: Thu Apr 20, 2006 9:12 am Post subject: How to grip and move the object with mouse |
|
|
hi all,
i need help (as everyone else) )
I'm trying to do the following.
whan i'm over some object and i press mouse button, after which i'm
doing the drag, i want that when mouse is moved the object also moves
but in such manner that the gripped point(on object)i s laways under
mouse pointer.
thanks |
|
| Back to top |
|
 |
Ced Guest
|
Posted: Thu Apr 20, 2006 12:12 pm Post subject: Re: How to grip and move the object with mouse |
|
|
(sorry I can't speek english very well)
It's very easy, Java3D already have what you need. Take a look at
MouseTranslate in the javadoc.
All you have to write is something like that :
MouseBehavior mouseTranslate = new MouseTranslate(this.mouseTransform);
this.mouseTransform.addChild(mouseTranslate);
mouseTranslate.setSchedulingBounds(schedulingBounds);
Don't forget to put the visual objects you want to move while your
mouse drag in the TransformGroup "mouseTranslate".
I hope my explanations are clear enough for you to understand :)
Take a look at the other MouseBehaviors : MouseRotate and MouseZoom,
they are also interresting. Do not use MouseZoom when you work with
parrallel projection. |
|
| Back to top |
|
 |
Ced Guest
|
Posted: Fri Apr 21, 2006 8:12 am Post subject: Re: How to grip and move the object with mouse |
|
|
Ah, and use the right mouse button  |
|
| Back to top |
|
 |
aleksandar Guest
|
Posted: Fri Apr 21, 2006 12:12 pm Post subject: Re: How to grip and move the object with mouse |
|
|
HI,
I'm very glad that someone has responded.
Unfortunately MouseTranslate behavior is not what I had in mid. I have
tried with it in first place.
When the button is pressed over visual object and mouse is dragged the
selected object follows mouse movements and that is OK.
But I also want that during the drag, object lies under mouse cursor -
so that it seems that i have grabbed a point on that object and that
point acts like a handle for moving.
thanks |
|
| Back to top |
|
 |
|