Models, Animations and User Input Events

Hi everyone, this is my first post here, sadly with a question and not a solution.



Ok, here is the deal.



I have a ms3d model loaded and it contains some animations in different ranges. In order to change the animation when a player makes an input I applied the Command Pattern (like in the FlagRush tutorial) implementing the InputActionInterface and writing a custom InputHandler. The actions just call methods in the "GameCharacter" class, which has access to the model, and the methods change the animation start and end times. As an example, I have a "JumpAction" calling a "jump()" method in the character class, that makes a "controller.setTimes(x, y)". This jump action is associated with the Space key.

My model has an Idle Animation which occurs in a cycle until some event occurs.



However I haven't found a way to make that the animation of the jump be rendered completely (this is, the character goes up and then down to the ground again) and that just after the jump it goes to the Idle Animation again.



The same happens with attack animations.



So … I want to know how to change the animation just when another animation finishes.



Also, how to define some kind of precedence to interrupt the animations, for example, an attack animation can occurs intermediately after a player hits a key, even if the character is in a loop of a "Run" animation. But if the character is in the middle of an attack animation, he can't "jump" or "Run".



Thanks in advance.



PD: I'm not sure if this question belongs to this forum section.

bump.



Anyone ?

However I haven't found a way to make that the animation of the jump be rendered completely (this is, the character goes up and then down to the ground again) and that just after the jump it goes to the Idle Animation again.


Use Controller.RT_CLAMP

controller.setRepeatType(Controller.RT_CLAMP);


Remember to set the controller to active if you want to run another animation

Also, how to define some kind of precedence to interrupt the animations, for example, an attack animation can occurs intermediately after a player hits a key, even if the character is in a loop of a "Run" animation. But if the character is in the middle of an attack animation, he can't "jump" or "Run".


When the animation is playing, the controller is active, so just don't change any animations when the controller is active

Thank you, that was just what I needed. :slight_smile:

If I'm using a ThirdPersonHandler for my WASD controls, is there any way to just tell it to play an animation when it's hit, or do I need to implement that on my own?

The input handlers are mostly there to show you how to do things.  When programming your own game, you'll probably want to subclass them or write your own based on the example so that you can completely customize it to your game's needs.  This will also allow you to tightly connect it to your collision system, animation system and network layer.

renanse said:

The input handlers are mostly there to show you how to do things.  When programming your own game, you'll probably want to subclass them or write your own based on the example so that you can completely customize it to your game's needs.  This will also allow you to tightly connect it to your collision system, animation system and network layer.


When you're referring to "them" you mean the ThirdPersonHandler in its entirety? What I've done thus far is just make it play the animation any time the W A S  or D keys are down and the camera takes care of itself  :D

Cool.  and yeah, by them I mean any of the control classes.