Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 02:07:16 am
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)FirstPersonInputHandler enhancements
Pages: [1]
Print
Author Topic: FirstPersonInputHandler enhancements  (Read 1958 times)
hawkwind
Getting respectable
***
Offline Offline

Posts: 363



View Profile Email
« on: 15. November 2007, 05:40:40 pm »

As I upgrade my game to the current xith, I realize aspects of what I am doing might be better implemented in the FPIH code.

Continuous move forward - I use the middle mouse button tp drive the view forward, mouse down move - mouse up stop.  I use the center of the bounding sphere of the shaped3d that the mouse button selects as a destination point.  It would be nice to have methods to "move continuously towards object X" or "move continuously forward in the current view direction"

I saw in one of the new test cases you use the CTRL to toggle between view tracking and view independent movement.  I do a similar thing only I used the rightmost mouse button.  In addition I make use of a number of cursurs based on view tracking/non tracking, mouse over pickable object, etc.  It would be cool to supply a set of methods one could override to describe to the FPIH what to do in certain conditions.  Now I have not really thought this through but suppose the FPIH had a Configuration class and a set of methods like MiddleMouseDown().  In it I could describe what to do and the FPIH would execute different methods based on user interactions.

public void middleMouseDown()
{
  Configuration.setCursur("blah");
  Configuration.setContinuousMoveForward(true);
  Configuration.setCollisionDetectionActive();
  Configuration.setViewTrackingMouse(true);
}

or

public void middleMouseDownWithCTRL()
{
  Configuration.setCursur("blah-blah");
  Configuration.setContinuousMoveForward(false);
  Configuration.setCollisionDetectionActive();
  Configuration.setViewTrackingMouse(false);
}

or we could treat things like a bit field where a user described actions for particular bi settings and then drove the FPIH by setConfiguration("0x3A")

public bit8Set()
{
Configuration.setCursur("blah-blah");
}

public bit16Set()
{
Configuration.setCursur("blah-blah-blah");
}


does this make sense??
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 15. November 2007, 08:04:37 pm »

Well, most of it is already possible (except for thsi Curus thing. What the hell is this? dict.leo.org doesn't know it and me neither.)

(I have applied a few fixes. So please update xith from SVN.)

To start continous movement forward you would do the following:
Code:
fpHandler.getKeyStatesManager().getKeyStatesManipulator().setKeyState( KeyCommand.WALK_FORWARD, Boolean.TRUE );
and to stop it again (and give the control back to the real key-states):
Code:
fpHandler.getKeyStatesManager().getKeyStatesManipulator().setKeyState( KeyCommand.WALK_FORWARD, null );

Do deactivate collision-detection (and simulation with it):
Code:
fpHandler.getPhyiscsObject().setCollisionsEnabled( false );
(The activation is obvious.)

To make the View face a certain point you can simply use the following code:
Code:
view.lookAt( point );
Or to use a known direction, but not a point:
Code:
view.setFacingDirection( vec );
After this you would have to invoke:
Code:
fpih.updateViewInverse();
and start the continous movement forward like above.

The Cursus (which I guess, is some kind of behavior) is more something for a CameraFlight or another utility class, but not for the FPIH.

I'm currently working on mouse-button-to-key-state mapping, which would enable you to (effectively) bind key-states to mouse-buttons, which is currently effectless. Then you can simply bind the middle-mouse-button to the WALK_FORWARD command like you would do for any keyboard-key.

Marvin
Logged
hawkwind
Getting respectable
***
Offline Offline

Posts: 363



View Profile Email
« Reply #2 on: 15. November 2007, 10:19:15 pm »

Cursus???...meant cursor...little graphical image that is moved by the mouse...hee hee sorry for the crap typing skills Tongue
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 15. November 2007, 10:20:20 pm »

Cursus???...meant cursor...little graphical image that is moved by the mouse...hee hee sorry for the crap typing skills Tongue

Ah Grin. Ok, the HUD has a Crosshair feature, that is meant exactly for this.

Marvin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 16. November 2007, 04:09:53 pm »

You can now simply bind a mouse button (almost) like a regular keyboard-key to a FPIH KeyCommand. There are special key-codes for the mouse buttons in KeyBindingsManager.

Do it like this:
Code:
fpHandler.getKeyBindingsManager().bindKey( KeyBindingsManager.MOUSE_MIDDLE_BUTTON, KeyCommand.WALK_FORWARD, KeyBindingsSet.SECONDARY );

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic