mouse control (hiding + resetting cursor)?

hi,

what is the best way for a typical fps mouse control?

The problems would be:

  1. Hiding the cursor.
  2. Resetting the cursor.
  3. Getting the cursor position in my behavior

OK, I know I could set the cursor to a transparent image. And yes I know I can set the cursor postition with the robot class. But since we have a fency 3D API, I wondering if a standard request like that is already implemented? I mean the Robot class is not really a perfect solution.

I hope there is a standard solution.

To problem 3: I have a behavior which awakes every 30 milliseconds. Then I need to get the cursor position. How do I do that without a mouse event?

thanx,

Usul

To read the mouse (not cursor, what you want is raw mosue input) look at JInput.

Don’t ty to count on synchronizing behaviros with render, they are inherently asyncrhonous.

You want all your game logic to be based on WakeOnFrame(0)

You might want to download JNWN (my current project) for an example of how to build a
usable game framework around.within J3D.

In the API it says

[quote=“Java3d API”] In general, applications cannot count on behavior execution being synchronized with rendering. Behaviors that use WakeupOnElapsedFrames with a frame count of 0 are an exception to this general rule. Such behaviors will be executed every frame. Further, all modifications to scene graph objects (not including geometry by-reference or texture by-reference) made from the processStimulus methods of such behaviors are guaranteed to take effect in the same rendering frame.
[/quote]
But what if I want to wake up only every 20th frame? Because I want to safe computing time and only compute my game logic every 20th frame (for example). Is this then still synchronized with rendering, or is really only WakeupOnElapsedFrames(0) synchronised?

Edit: OK, forget it, it I realised that was a stupid question.

So with pure Java3d a fps - like mouse look is not implemented or possible without the robot class?

But what if I want to wake up only every 20th frame? Because I want to safe computing time and only compute my game logic every 20th frame (for example). Is this then still synchronized with rendering, or is really only WakeupOnElapsedFrames(0) synchronised?

Edit: OK, forget it, it I realised that was a stupid question.

So with pure Java3d a fps - like mouse look is not implemented or possible without the robot class?
[/quote]
Quite possible, and not with robot. Use JInput to read the mouse. I forget how to hide the cursor but there is a way. (of al lelse you could just set
the cursor to a custom cursor thats nil, but there may be a better way.)

ON the first question, yo uwake every frame, and you do whatevre yo uwant. That might be increment a rame counter and exit unelss its
20.

But I wouldnt time anythign based on render rate because that varies all over the palce and you willget uneven results, Do it based on real elapsed clock time.

thank you. I use robot now and I’ll change it to JInput in the future.