Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 28 Oct 2007
Offline Last Active Today, 04:25 AM

Topics I've Started

Animate in place?

22 October 2014 - 05:50 PM

In my animation system, I am currently playing animations with motion accumulation built into the animation. So, for instance, my walk forward animation has my player at 0,0,0 but the root bone of the skeleton moves the character forward as it contains relative offset translations from 0. In a looping animation such as walking forward, I keep the character position at 0 and when the animation loops back to frame/sample 0, I move the character's position to the last frame's root bone's position. This works okay.

For rotational accumulation, things aren't _quite_ as pretty. I do the same principle but instead of the root bone offset translation for movement, I store the effective yaw of the root bone at each frame. When the character turns to the right, the player entity's world yaw stays at 0 whilst the root bone is rotated by the accumulated rotation in the animation. When the animation loops, I set the player's yaw value to the previous frame's root bone yaw value,

I'm doing it this way as I do or will need the absolute position of the player for collision and foot placement on terrain, etc.

This does kind of work except I get a tiny little inconsistency with the rotation when it loops. I'm not asking for a fix for that because I can probably eek it out and mangle the code a bit more until it works. My question is more about whether this is the correct way to do it at all. The other option I've considered is to remove the translation and yaw from the root bone and place it alongside the animation set and move the player's entity position/yaw every frame. I feel this might be easier from a blending perspective because everything would be blended in the same local position and then the yaws of the root bone get blended.

The way I'm doing it at the moment just seems like it's attracting some pretty ugly code and dependencies in order to get it to work.

Any thoughts?

Finding skeleton joints in world or object space

06 October 2014 - 12:56 PM

I'm trying to experiment with IK on my skinned animations and although I wrote the code, I haven't looked at it in a while and I'm slightly confused by something.  What I'm trying to do at the moment as a first step is find the vector between where I want my foot position to be and the thigh joint.  This means I need to compute where the pelvis joint is in world space.


My animations are converted and exported in from a COLLADA document (not at runtime) that I have exported from a 3d art package.  What I've suddenly become confused about (I don't speak the language of Matrices very well) is what the matrices of the animations for each bone represent.  I'm pretty sure I'm doing it the standard way:


Starting from the root bone, I iterate though its children and multiply up the animation matrix with its parent's animation matrix - I call this the world matrix at each level.  Then at each level, I multiply the world matrix by the inverse bind matrix and call that the working matrix.  This gives me a full pose of working matrices that I pass to my shader - this all works nicely.


So if I wanted to find the position of any joint in world space (or even object space would do at the moment), how would I do that?  I thought I could simply multliply up the animation matrices to the level I wanted and that would be that, but when I do that and place a box marker that that point, it's nowhere near the joint on the model.  In fact, if I place several boxes at the root, pelvis, lower spine, right thigh, right calf, they all seem to be heading along the x direction with a similar height, not as I expected.


I then tried multiplying each level by the inverse bind matrix (after multiplying by the parent's animation matrix - as per my normal skinning method) and, again, they don't end up in the right positions.


Am I missing something?  Do the translation parts of the animation matrices not contain the joint positions (iteratively)?


Thanks for any help

Lining up animations with motion

22 September 2014 - 02:19 AM

So my animation system is really getting somewhere. Using data, I can specify my full animation state machine with blended transitions and blend trees, really happy so far.

So I was playing about with my mocap suit adding some test animations and I thought it might be good to have my character turn on the spot left and right using animations rather than just spinning him. So I did an animation of me standing idle and turning on the spot to around 90 degrees.

So I added it into my state machine, a transition from idle to the turning left state (blending in 0.2 secs), then, after the turn left animation completes, an auto follow-on transition for turning left into idle (again blending in 0.2 secs). The transitions all looked fine but of course when he went back to idle, he flipped from 90 degrees left back to facing forward again.

I knew at some point I'd have to combine the animations and positioning/orientation in some way so set about having a go. One issue was that my animations blend between each frame including the last and first frame and if I suddenly jump the character by 90 degrees when the first frame is used, I get a little frame arctifact where it shows the tween between last and first. To circumvent this I decided to allow animations to blend between all frames apart from last to first. This stopped the little arctifact showing after his orientation was changed but it meant I had a 'pop' where, although he was facing in the right direction, the last animation frame didn't match the first - something that blending solves.. Hmm...

So as far as I see it, I have two options.

1) do the turn mocap animations in situ, meaning I do the action of turning but I somehow keep the same heading, kind of like a rotational moonwalk! Can't see this being viable (let alone possible).

2) I play around with my animations before exporting them to my engine to ensure that the last frame matches the first exactly. Seems feasible but might be fiddly and a lot of work.

Walking will probably not be such an issue as he's facing the same direction so I can blend them.

Has anyone had experience of this before that may be able to offer some guidance?

Animation states and blend trees

07 September 2014 - 05:20 PM

In a game with a complex animation system for a player, when using an animation blend tree, would one tree be used for all possible animations?  Or would there be, for example, one blend tree for idling, one for walking/running, one for punching, kicking, or whatever moves there are?  I've created a binary animation blend tree system which is pretty flexible but I'm not sure I should be making it so complex to contain all of my animations.


And also, how does the animation state machine relate to the blend tree?








UE4 build tool

04 May 2014 - 03:39 AM

Has anyone worked out UnrealEngine 4's build system yet?

The projects contain various different OS cpp files (iOS objective C files for example), and the build system doesn't attempt to build them (even though under win7 in the config properties 'build' is ticked under x64).

Also, when you build from clean, it appears to build and run the unreal build tool which is a dependency of the UE4 project - I can't see any post build steps in the config.