Game Development Community

Animation/Model problem

by Drexel (#0002) · in Torque Game Engine · 04/15/2008 (11:02 pm) · 3 replies

I'm having an issue where the model for my player is spawning twice. One is in a t-stance (and backwards) and the other animates properly. The proper model only shows up when I exec the .cs file with the animations (maleTeen.cs). The dts is maleTeen.dts, the cs file is maleTeen.cs and is in the same directory. This is what maleTeen.cs contains:

datablock TSShapeConstructor(MaleTeenDts)
{
baseShape = "./maleTeen.dts";
sequence0 = "./m_teen_root.dsq root";
sequence1 = "./m_teen_forward.dsq run";
};


And when I spawn a new player this is the datablock I use:
datablock PlayerData(m_teen_mage : BMage)
{
shapeFile = "~/data/shapes/player/male/maleTeen.dts";
};

BMage is also inhereted from BasePlayer (a modified version of the standard PlayerData block)

A screenshot of exactly what is going on can be found here:
http://projectgenerations.cs.drexel.edu/anim_problem.JPG

#1
04/16/2008 (9:22 pm)
It sounds like the problem is "above" the level of the player animations, per se, and in the spawning code. For example, it's spawning two objects instead of one, and only one has a client or controlling object or something like that. I'd step through the spawning script with a script IDE like Torsion.
#2
04/17/2008 (1:25 pm)
Any time you have animations that are exported as external DSQ's you must write and exec a script with a TSShapeConstructor. That is the only way that Torque knows which animations belong to which DTS and what those animations are called. Using external DSQ's allows you to re-use the same animation DSQ's for different DTS' (as long as the skeleton and rigging in the same, of course) as well as to "re-alias" DSQ's with different names.

Now, as for your 2 objects showing up, I would (as Lee suggests) check your "spawning" code (the code that actually creates the Player object). If you haven't changed that from the default structure, it will be in a function called CreatePlayer in game.cs.
#3
04/17/2008 (1:27 pm)
You know, looking at your screenshot, it might be a source (DTS model) problem. For whatever reason your "root" animation seems to be telling Torque to create an entirely new mesh instead of just moving the existing one. I would load up your model in Show Tool Pro and see what it looks like there. That will tell you if its your code or if its an art issue.