Game Development Community

Animating and Colliding with Static Shapes

by Derk Adams · in Artist Corner · 06/18/2005 (7:25 am) · 12 replies

Greetings,

I am trying to animate the destruction of a building (StaticShape). I can make it so that I can collide with the building (to take damage) and I can create an animation to play (Milkshape requires bones to animate). But I cannot put the two together because an object with nodes causes castRay to crash the game. The exception is at "mat = *previousMat;" in:
if (mesh->getTransform() != previousMat)
         {
            // different node from before, set up for this node
            previousMat = mesh->getTransform();
            mat = *previousMat;
            mat.inverse();
            mat.mulP(a,&ta);
            mat.mulP(b,&tb);
         }

Any suggestions?

Thanks

Edit: I'm using 1.2

#1
06/23/2005 (2:40 am)
Well, for anyone who reads this later.

You can't use bones to animate a static shape in MilkShape; Torque doesn't like it. I ended up making multiple meshes and then animating the visibility in the exporter. A little jumpy because I don't have enough "frames" but it works.

Thanks.
#2
06/23/2005 (7:24 am)
Sorry but you cannot animate a collision shape in a DTS, when you do this the engine stops treating the collision shape as it should. Thus your only solution is to in code animate that particular node transforming in the game world.
#3
06/23/2005 (7:38 am)
L Foster,

If I understand your statement, you misunderstand my question. I do not want to animate the collision mesh. I already have a way to turn them on and off.

I am looking for the visual mesh of the building to "fall in on itself." The best option would be to animate with bones and have the exporter make mesh snapshots every frame, removing the bones. Alas, the function is untested and doesn't work, so I have to make the mesh snapshots myself.

And in summary, the collision mesh does not change.

Thanks.
#4
06/23/2005 (8:18 am)
I'm not entirely sure about the programming parts of torque, but... doesn't the words "static" and "animated" sort of conflict with each other? =)
Why not make the model an animated one (in which case animating it with bones should be no problem, right? I use max, so I don't really know about milkshape specifics either).
#5
06/23/2005 (12:46 pm)
Magnus,

StaticShape is just an extension of ShapeBase. There is nothing keeping it from "moving."

However, I am not moving the object (it's a building), but I do want to animate its destruction.

Everything in Torque that has animations, does not use collision meshes (I could be wrong, but I didn't find any). Therefore, the engine, when doing collisions, does not expect to find a node structure in place (used for animations). The solution was to do animations without nodes (mesh multiplication).

As another possible solution, I am going to try to make a simple object with a collision mesh and on destruction delete the object and put in a new object that is the animation but doesn't have a collision box. But I don't know how the network timing will work yet.

Thanks.
#6
06/23/2005 (1:19 pm)
Couldn't you make an invisible .DIF just for the collision and forget about the collision mesh in the .DTS?
#7
06/23/2005 (1:40 pm)
...
#8
06/23/2005 (3:24 pm)
Dirk,

I haven't touched difs because my game is completely outside and it is just another program to learn (dts was hard enough).

Joseph,

I have used your resource (that is why I'm not worried about "animating the collision mesh"). If you can get an animated shape with bones and a collision mesh from Blender then the issue must be with the MilkShape exporter. Since that is my main art tool, I am having to work around the issue.

Currently, I have the shape and collision mesh at the start. Upon destruction, I switch off the collision mesh (your resource) and play the animation. The issue has been that for MilkShape the animation can't use bones or the engine crashes.

The problem with this method is that all of the meshes are visible in the initial state and then turned off when the visibility animation plays. This is why I'm going to try the object swapping to potentially save the poly count and allow me to animate with bones.

Thanks.
#9
06/23/2005 (4:09 pm)
...
#10
06/23/2005 (6:10 pm)
Quote:Everything in Torque that has animations, does not use collision meshes (I could be wrong, but I didn't find any).

this may be a dumb question, but what do you mean by this? dont most objects have animations and collision meshes?
#11
06/23/2005 (6:50 pm)
This might seem redundant; I've been fiddling with visibility animations[in Milkshape too], but I did not need any 'Nodes'[mse3d joints/bones/skeleton] to produce this type of sequence. Does the subMeshes of the start01 need to have rotational/translational values input? If not, don't use any Joints/Bones/Skeleton for the sequences. If you do need a DTS shape with sequences, I could perhaps help out. I've a license for GameSpace and it also does Visibility animations and doesn't need any 'Nodes' to produce a sequence. If you like I could try this particular shape and see what I could produce...

Of course I'd need the Source file and some directions on exactly what you need to have in each sequence...I don't mind. I've been fooling with Visibility for a few days now, and have produced some good results. I have however; found getting Visibility to work on mulitple subMeshes a bit tricky. My results didn''t work exactly as intended in the engine/showTool, while the .DMP file shows visibility writtten into the shape??? So it's either in the exporters[for both] or lack of proper setup?!?

Let me know if I can help.
#12
06/24/2005 (9:04 am)
Sean,

We already figured that it is an issue in the exporter.

Rex,

Thanks for the offer. I have been successful in swapping objects, which is better on the frame rate also. For visibility, I have used startFade() to make the entire object disappear. With this method I don't have to worry about animating visibility as I can use bones. In MilkShape there is an explode function which sends the polys flying.

I would be happy to have you help with aspects of the game. If you are interested, email me.

Thanks.