Control Interface questions

I am having trouble wrapping my head around how to use the Control interface. Is this, in a nutshell, how controls work :



You have a character under your control that is walking. You walk him into a wall. A function in a control is automatically called (what calls it / how is that set up?) that starts an animation of your characters mesh falling down.



Implementing this :



You create a class that implements Control. Within the update() method goes the animation related code.



I am still unsure on how to attach a control to a spatial (I bet theres a [spatial].attachChild(…) or similar function for this) or how to connect a key press to a control (again, I probably need to go over the docs even more)



Looking at monkeyzone, I also see controls like HUDControl, UserInputControl, EffectsControl etc… So basically, a control can get attached to anything? A game basically IS the control functions isnt it?



Lastly, a suggestion. ‘Control’ is VERY ambiguous. Google thinks ‘AWT control? Swing control? version control? radio button / drop down type control? Industrial control?’. This makes it difficult to google articles on this topic. I would suggest (feel free to dismiss the idea) renaming ‘Interface Control’ to ‘Interface Behavior’, or something less ambiguous at least.

as far as googling goes, "Jmonkeyengine " its pretty easy, and the questions you raise are nearly all answered in the wiki, under collision (hitting the wall) and custom controls, also check Java docs, the methods and their descriptions really do explain alot.

you attach controls to spatials. You do so using:[java] spatial.addControl(new YourControl());[/java] And you can get access to the control using spatial.getControl(YourControl.class). If you want a function in a control to be called upon an event such as colliding with a wall, you can implement the PhysicsCollisionListener, and then respond to the collisions any way you want. Not sure what you mean by connect a keyPress to a control.



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_controls

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics_listeners