# Player physics

I am designing a fight demo and would like to use jmephysics/2 for the collision detection/reactions but I am unsure about the best way to handle it. I'm thinking of using forces combined with fall and hit reaction animations and the characters are animated to be agile so they are intended to jump, slide and bounce arround alot.

what might be the best way to sync the anims with physics.

how well will it work with the chasecamera/thirdperson controller.

also could you give me hint(code snip if possible) of how to do physics based directional jumping and climbing

Maybe you can draw some ideas from a topic on javagaming.org. NewbTon even did a boxing game with odejava. The same physical modelling should be possible in jmephysics(2), too.

thanks I'll look into it, but coded AFs might be a bit beyond my coding skills at this time. all I need is an idea of how keep the physical reactions manageable had tried with the old jme-physics but the result won't that good, basically all I need the dpo to do is slide/fly reasonable distances with a minimum amount of bounce or spin when forces are applied, I did get a good idea of how to keep my player balanced though.

as for the jumping thing how do I…is it simple a matter of adding forces the the player/npc y/up direction, will jme physics account for the xz heading and velocity automatically. forgive my ignorance this is the first time I am digging deep into the physics api, and unlike jme there isn't tonnes of examples to learn from.

mcbeth said:

... unlike jme there isn't tonnes of examples to learn from.

yes, that's true - I still have many in my mind but can't find the time to code them....

You can do all you described with forces. Even better would be using joints where applicable.

Regarding balancing, you can either restrict rotation to a given value by setting it back each frame (not that good but really easy), or you can apply forces according to the unwanted rotation in before each physics step (quite ok), or you can construct a set of joints that allow translational movement buf restrict rotation with special spring stuff (CFM, ERP) set (really good, but currently quite complicated - I want to improve that in jME Physics 2).

thanks I'll take a closer look. if you do get the time to put those test/examples together in the "hopefully not to distant "future would you consider writing a character centric test of some sort, first/third person or something… if it's not to much trouble that is

and thanks again