Moving physics location of character through animation

Both a theoretical an codewise question here.

I understand how to move a character through physics for general walking purposes, but is the general way you move a character through physics for a specific animation?

Here is an example. My animation is a guy doing say, a forwards kick. This kick, in the animation, propels him through space forward, landing a certain distance away from where he started. How do I grab the physics location of where he ended, and make that his new physics location. For some reason, I can’t seem to grab that certain physics location. Or is it that the physics location never actually changes, only the spatial due to the animation?

If the latter is true, should I ask my animators to NOT move the character through space when animating? Doesn’t that make it sort of hard to animate the movement naturally? And if this is the right way to go about it, how should I sync the physical movement of the character with the animation?

A lot to ask, but hopefully, you can see the broad concept of hooking physics translation with animation movement that I’m inquiring about.

I think the animation shouldn’t “move” the model, only animate it.
For example, an animation that makes a model walk doesn’t displace the model.
Your code will be responsible for moving the spatials.

@machspeeds you can check character animation with physics here.
http://code.google.com/p/rise-of-mutants/

API is buggy but you can learn some things there.

Is this a simple collision shape, or a hull surrounding the character? If its a simple one, you could potentially move the shape to follow a position vertex of the model, else there is a kinematic ragdoll you can use. In general yes, you should be centered when doing these animations, if will make your life a lot easier

@loopies
Good point, I don’t know why I didn’t think of that.

@mifth
Thanks, I’ll look into it. I’ve looked at that code before, but I think that was when I was deciding whether or not to dive into JMonkey, not for actual reference.
I guess giving the animators the Sinbad model as reference would also help them too.

@wezrule
It’s just a capsule collision shape, nothing special right now. I’ll try your suggestion after I look into the centered animations option. It sounds like that is a lot easier, which is always better :slight_smile:

Thanks for the advice guys, I’ll report back as soon as my animators finish an animation without the spatial translation for testing. Unfortunately, the main one has midterms this and next week, so we’ll see when he gets that animation done :slight_smile:

Just set the physicsControl to kinematic mode and then move the spatial, the physics object will then be moved along with the spatial and also influence other objects (but not collide with static objects, its position is defined by the geometry after all). Then when you want it to be physics influenced, disable kinematic mode and work by applying forces to the physics object again.

Will the model, when physicsControl is set to kinematic mode, be influenced by it’s translation in animation? Or are you suggesting that with that animation, actual move the spatial’s location, and then after disable kinematics.

Or is your suggestion supposed to complement the animations once the spatial translation in the animation have been taken out?

Animation deforms the mesh and has nothing to do with moving a spatial. If you talk about spatial animation or just moving a geometry, as said, it will move the physics object along with it when the RigidBodyControl is updated.

I understand now, thanks. I’ll see what effect the disabling and enabling of kinematics has and see if it helps me move my character properly.