Controller vs InputHandler

Hello.



I have some experience with Java (~5 years) and want to create a little 3D Applikation using the JME.



I have subclassed Standardgame and added one gamestate which I subclassed from CameraGamestate.



Now I wish to implement some movement. I have A node which contains the Geometry of the Player and a ChaseCamera to follow it.



Evaluatiing the best method of implementing movement , I came across some classes:

com.jme.input.InputHandler

and com.jme.input.controls.controller.Controller



I have been able to implement some movement by subclassing InputHandler.

In another test I was able to sucessfully implement movement with subclassing Controller or using ThrottleController and RotationController.



No I want to figure out, when it is better to implement movement using Controller and when it is better to use InputHandler.



Is there a way programmers are supposed to do it? Is one of the ways better then the other?





I hope you can give me a clue, why there are these two opportunities to implement movement.





(If you find any mistakes in my post according to language, feel free to correct them. English is not my native language, but i tried to write correct english sentences ).

I wrote the Controller system because I didn't really like the other input systems of jME. Either approach is perfectly acceptable in most cases, but you have the ability to choose for yourself which one you prefer. :slight_smile:

Hello darkfrog.



Thanks for the answer.



I have now chosen to create my own Controller to implement movement in my application, because i don't like the InputHandler class, too.



It seems to be easier and the sourcecode keeps clean this way.

My "jME3" will have an input system that is much simpler to use, I would say it's quite similar to what DarkFrog has there, except that it's actually integrated with the entire engine :wink:

Momoko_Fan said:

My "jME3" will have an input system that is much simpler to use, I would say it's quite similar to what DarkFrog has there, except that it's actually integrated with the entire engine ;)


Integrated how?

Do not forget that to tie all things together is to tie ones' own hands as a developer. :)
darkfrog said:

Integrated how?

Do not forget that to tie all things together is to tie ones' own hands as a developer. :)

I am already done with it at this point. It's integrated in the way that things like FlyByCamera or SoftwareCursor use it for quering input, or do you prefer the old jME InputHandler way of doing things? ;)
The Application class automatically initializes the input system for you to make it easier, but no-one forces you to use the Application class. In fact, the only thing that "ties things together" is the Application class, really, it's nice when you start doing your app/game and everything is already set up for you, ready for use.

Sort of like StandardGame? :wink: