Game Development Community

Synchronizing multiple StaticShape animations?

by Andrew Hruza · in Torque Game Engine Advanced · 06/11/2009 (1:25 am) · 8 replies

I'm working on a project where I have 17 objects positioned around a central hub, and I'm trying to rotate them all on the same axis simultaneously. Previously, I'd tried doing it purely in the scripts (Calling setTransform on each object), and while it technically worked, no matter how I messed with scheduling, it was choppy.

So, what I have happening now is a set of .DSQ animations for each object, set up so that if everything started on the same frame, they'd match up perfectly (and with the .DSQs, they're nicely smooth.) The problem now is that the last 4-5 objects are lagging about a half second (15 frames) behind the first objects, and I've been racking my brain (and scouring the site / help files) for ways to start eighteen animations all at the same frame, and outside of some very hacky work with scheduling (that looks like it'll wind up with the same problem) and setTimeScale(where I haven't found any threads with anyone who's actually gotten it to work properly), I've got nothing. It -might- be an issue with polycounts (and tommorow afternoon, I'm going to try and get some simpler models swapped in), but my gut feeling is saying that it's a code-based problem.

Can anyone toss some advice my way? I'm using TGEA 1.8.1.

About the author

Recent Threads


#1
06/11/2009 (2:12 am)
It is the scoping.
You need high priority.

staticShape.h

F32 getUpdatePriority(CameraScopeQuery *focusObject, U32 updateMask, S32 updateSkips);

staticShape.cpp

F32 StaticShape::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 updateSkips)
{ 
  return 10.0f;
}
#2
06/11/2009 (3:00 am)
Thanks for the response!
Doesn't seem to make a difference in my Debug build, however... I'll give it a shot in the Release build as soon as I figure out what I broke in it, though! (That'll teach me to work purely in one mode. Something to do with the Advanced Camera resource. Ah well- That's for the morning!)

(Edit)
Though it now occurs to me (after shutting everything down for the night)- Was that advise geared towards getting the setTransform method of rotating stuff to perform better, rather than playing animations?
#3
06/11/2009 (3:20 am)
shapeBase.cpp
replace with:
F32 ShapeBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 updateSkips)
{
   if (camInfo->camera == this) return 10.0f; 

   if (camInfo->camera && (camInfo->camera->getType() & ShapeBaseObjectType))
   {
      if(((ShapeBase *) camInfo->camera)->getObjectMount() == false) 
         return 10.0f;
   }
   return Parent::getUpdatePriority(camInfo, updateMask, updateSkips);
}
#4
06/11/2009 (1:19 pm)
Hrm. Still getting the animations delayed.
#5
06/11/2009 (1:30 pm)
If all else fails and if you are able to edit the animations, it may just do you better to change the last 4-5 objects animations to accommodate for this lag. Just another possibility if you can't get anything else to work :)
#6
06/11/2009 (1:43 pm)
Yeah, I was considering that- I'll need to test it on a couple other machines, though, and see if it's consistent or not. Otherwise I might just make the problem worse somewhere else!
#7
09/10/2009 (6:41 pm)
Re-bumping for the guy from PAX (Sorry, I'm horrible with names), finally got back to where I could get in.
#8
09/12/2009 (8:43 pm)
If you want to play the same animations on all your shapes sharing the same TSShape then you can just create one TSShapeInstance and share it between your objects.

You'd only have to advance the animations once and then all your objects will be perfectly identical. It does require some changes in C++ though.