Input+animation, is this a bug?

hi

when I release a key the animation will run, is it normal or a bug?

I thought when I press the key the animation should run immediately

I tried press and hold down the key for a while(flick a lot), press and release in that video (flick only once)

here is the video

http://www.youtube.com/watch?v=sZw8eIwse8Y


Check before start animation than this animation isn't playing now.

When you call start animation, animation is reset to zero (in case of AnimationMeshController use). So youre animation is always reset until you unpress the key (and then it running well)

anykeyh said:

Check before start animation than this animation isn't playing now.
When you call start animation, animation is reset to zero (in case of AnimationMeshController use). So youre animation is always reset until you unpress the key (and then it running well)


I use AnimControl and AnimChannel in Jme3
I checked in javadoc of jme3 and only found these two
MeshAnimation
MeshAnimationLoader Utility class used by OgreLoader to load poses and mesh animations.

but I dont know how to use them, either boneanimation
if I remember well then there were 3 case in jme2 keyrelease,keytype and keypressed, but I cant find anything like them in jme3

well if what you mean is the animation loop you can use the method i beleive in animchannel .setLoop and use the enum value Loop.DontLoop somehting of the sort



if your are talking about the fact that everytime you press another button the aniamtion in progress automatically restarts to 0 I am unsure of that

are there any way to make the animation run immediately when I press a key

instead of running the animation when the key is released

or tell the animation reset only once when I pressed the key

Check if the animation is already playing using animChannel.getActiveAnimation(). If it's not set, then you can set it.

Momoko_Fan said:

Check if the animation is already playing using animChannel.getActiveAnimation(). If it's not set, then you can set it.


is that code in jme3 ?
I typed animChannel. in eclipse and dont see getActiveAnimation, just getAnimationName,getClass,getSpeed,getTime and getLoopMode

Ah yes, its getAnimationName()… same thing.



Also, I added a new input system (its in SVN right now and a test will be there as well). This new input system will allow you to detect when somebody presses a key rather than constantly getting an event for each frame the key is pressed.

This new and improved input system should provide many of the features that the current simple one is missing.

Momoko_Fan said:

Ah yes, its getAnimationName().. same thing.

Also, I added a new input system (its in SVN right now and a test will be there as well). This new input system will allow you to detect when somebody presses a key rather than constantly getting an event for each frame the key is pressed.
This new and improved input system should provide many of the features that the current simple one is missing.


is the new input system: com.jme3.input.controls
I saw its method : onAction(java.lang.String name, boolean value, float tpf)
it looks promising, but I still dont know how to use it.(first register the keys ^^ )
I'm looking forward to the test ^^

but there are quite a lot of input system in jme3,isnt it ? I can already see 7 of them. hope they wont turn to a big mess like model loading in jme2 ^^
xieu90 said:

is the new input system: com.jme3.input.controls
I saw its method : onAction(java.lang.String name, boolean value, float tpf)
it looks promising, but I still dont know how to use it.(first register the keys ^^ )
I'm looking forward to the test ^^

but there are quite a lot of input system in jme3,isnt it ? I can already see 7 of them. hope they wont turn to a big mess like model loading in jme2 ^^

Yeah it's in input.controls
You'll know how to use it. It's pretty much the same as the older system but more flexible in many ways.
There are no 7 input systems.. that's your imagination. There are only 2 right now, and the old one will be replaced by the new when it is deemed stable.

Hi, is the test out yet ?

I checked in nightly build but didnt find any thing new.

Momoko_Fan said:

Yeah it's in input.controls
You'll know how to use it. It's pretty much the same as the older system but more flexible in many ways.
There are no 7 input systems.. that's your imagination. There are only 2 right now, and the old one will be replaced by the new when it is deemed stable.


Hmm.. I wouldn't say I'd "know how to use it". It seems almost impossible to pick up having not designed it.  :|

I've been messing around with it for the last two hours. Do I still need to use InputManager? If so, I created a new Controls class, and then attached that to InputManager as a RawInputListener.

Then I attached the class to Controls as a Listener, and made it implement your ActionListener, and have a onAction method. But then for each key that I wanted to listen on, I had to call controls.addListener and controls.addMapping. I also had to create a new KeyTrigger for each key I wanted to listen on. And then I had to modify Controls so that eventsPermitted was always true, otherwise the program crashed immediately.

Please could you enlighten us less educated folk on how this new system works?  :?

EDIT:
Ok, I've worked out that you don't need to use InputManager as well, however there is an issue if you are extending SimpleApplication as Application defines an InputManager and attaches the Key/Mouse/JoyInput classes to it, which then add the InputManager as the only listener attached to the Key/Mouse/JoyInput instances. If you try and create a Controls class and an InputManager class, the last one created will be given all of the events from the XInput classes. There are two solutions: let the XInput classes have two listeners (doesn't really make much sense, especially as the old Input system will soon be removed); otherwise the Application class needs to be updated to use Controls instead of InputManager and all the classes that rely on it need to be updated.