Flavius Alecu wrote:

First, when I run my applet with freelook, the cursor is always positioned
in the middle of the applet, but does not disappear. Is there a way to
make it invisible?

Yes. You need to set cursor to custom image, with nothing on it. I think that following code should work (but I have not tested it, just dug out of my old code)

Dimension dim = Toolkit.getDefaultToolkit().getBestCursorSize(16,16);
BufferedImage bi = new BufferedImage(
  dim.width,dim.height,BufferedImage.TYPE_INT_ARGB);
setCursor(Toolkit.getDefaultToolkit().createCustomCursor(bi,
  new Point(dim.width/2,dim.height/2),"empty"));

Also, soemtimes, the applet hangs and I can move the
mosue cursor, but just for two or three seconds then the cursor is
re-positioned to the middle and I can move the view again.

Does it also happen when you run application as stand-alone ? Can you turn on -verbose:gc and see if the breaks happen at same moment gc is running ?

Last question now...could you maybe help me make the rotation smoother? I
tested your MythLookBehavior and it is really great, but I can't really
use that technique in the freelook class because I honestly don't
understad it.

Neither do I anymore - as you have said, there are no comments... :)


In MythLook, when you press a button, you do not move the view, only
change internal flag. Every frame, behavior checks these flags and
modify turning speed accordingly. If no button is pressed for given
degree of freedom, speed in this direction is decreased gradually. If
flag is present, speed is shifted into that direction (only to certain
value of course).

Code is more complicated that it needs to, because I was testing it on
Windows98 without high-precision timer - so I had to average per-frame
time over many frames. Every 100 frames, average was taken from last 100
frames. Every 10 frames, this average was modified a bit into direction
of last 10 frames average. Still, with very low framerate, you had to
wait few seconds before system started to rotate with target speed.

You can apply same technique to keyboard control in FreeLook. As for the
mouse movements, it is not so easy I'm afraid. I think (but you will
need to play with parameters), than mouse control should start at full
speed (with no acceleration period), just instead of stopping at end,
decrease speed over time of few next frames (but only few - probably
inertia of 100ms and few pixels will be enough, any more and you will
get into 18-wheeler turning mode).

Artur

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to