I'm sure this is a simple question for most to answer -
All I'm trying to do is to move a bone in my code, but I cannot seem to get the bone to update its position while an animation is playing. As soon as an animation stops playing, it seems to work fine.
All I'm doing at the moment is setting the Bone.X and Bone.Y
trajectory.Y += Gravity * gameTime;
var location = new Vector2(Bone.X, Bone.Y);
location += trajectory * gameTime;
Bone.Rotation = rotation;
Bone.X = location.X;
Bone.Y = location.Y;
Bone.UpdateWorldTransform(false, false);
and then later on when the character updates I have the following:
AnimState.Update(frameTime);
AnimState.Apply(skeleton);
skeleton.UpdateWorldTransform();
bounds.Update(skeleton, true);
What am I missing? Any help appreciated!
Urgh.. nevermind.. think I figured it out. I was modifying the Bone instead of the BoneData. Seems to work fine now!
Sorry, guess spoke too soon. The above works fine for setting the bone position relative to its parent, but I want to set the world position of a child bone, without its parents transforms. Looking through the forums I can't see any info on how to do this with XNA, so would really appreciate the help. Matrix stuff isn't my strong point..