Code based animations problems
by James Steele · in Torque Game Engine · 08/16/2005 (7:54 am) · 7 replies
I've been modifying the positions of nodes in a skeletal shape instance in code so that the wheels of my vehicle match the movement of the suspension. Now my suspension code works just fine, as does the caculation of the wheel position.
The problem that I have is that even, the wheels don't seem to be updating every tick even if I call the following code;
Instead, the wheel positions (relative to the body) only seem to be updating every half a second or so. Is there anything else that I have to do in order to force the nodes to update on a more regular basis?
The problem that I have is that even, the wheels don't seem to be updating every tick even if I call the following code;
mShapeInstance->setDirty(TSShapeInstance::TransformDirty);
mShapeInstance->animate();Instead, the wheel positions (relative to the body) only seem to be updating every half a second or so. Is there anything else that I have to do in order to force the nodes to update on a more regular basis?
About the author
#2
08/16/2005 (8:33 am)
Hmm...I don't think I'm checking to see if it's the client, and no; I'm not calling the code from interpolateTick()
#3
08/16/2005 (8:56 am)
And a quick test reveals....nada. It's still happening with the following code;void
COpTrackedVehicle::interpolateTick(
F32 lrDT)
{
if (isClientObject())
{
UpdateAnimation();
}
}
#4
08/16/2005 (11:42 am)
Are you actually setting new positions every frame/tick?
#5
08/16/2005 (5:03 pm)
@Ben as far as I can tell, I am. Every time UpdateAnimation() is called, it sets the positions of ALL of the suspensio nodes in the shapeInstance.
#6
So the code looks like this;
This appears to fixed the problem, but the movement still looks a bit weird occasionaly, but this may have something to do with the performance of the Debug build when dealing with rigid body update.
08/16/2005 (7:31 pm)
I've actually moved my call to UpdateAnimation() into a redefined renderObject(), before it calls the parent renderObject(). The way I see it, this is pretty much the only way I can gaurantee that it will change the node instance transforms before rendering. So the code looks like this;
void
COpTrackedVehicle::renderObject(
SceneState * lpState,
SceneRenderImage* lpImage)
{
UpdateAnimation();
Parent::renderObject( lpState, lpImage );
}This appears to fixed the problem, but the movement still looks a bit weird occasionaly, but this may have something to do with the performance of the Debug build when dealing with rigid body update.
#7
08/16/2005 (9:37 pm)
Looks good to me.
Associate Paul Dana
are you calling it from interpolateTick() ?