Game Development Community

Make a basic dynamic object

by Hasitha · in Torque Game Engine · 05/14/2007 (3:05 pm) · 7 replies

I'm sorry if this is terribly stupid, or that I'm not seeing the obvious, but how do you get a simple object into Torque that has physics applied to it. A basic dynamic object.

I've looked into the datablocks, but the only one that seems to fit is the ShapeBaseData datablock. I've tried that; I've built the 'create' function for it, but it still doesn't work. What do I do?

#1
05/14/2007 (3:25 pm)
Example:

datablock StaticShapeData(name_your_object)
{
category = "misc";
shapeFile = "~/data/shapes/your_object_directory/your_object.dts";
};

Create this in a file called yourobject.cs (can be any filename) place it in the server/scripts directory.

Then in server/scripts/game.cs add the following to where the exec statements are down near the bottom.

exec("./yourobject.cs");

You should see this in the editor within your game under the misc category.
#2
05/14/2007 (3:26 pm)
I think that's what you're after... if not, let me know :)
#3
05/14/2007 (3:33 pm)
Wow, that was quick!

That was sort of what I was after. I've seen script like that before. But I want the object to be dynamic, not static. Is there a different datablock for that?
#4
05/14/2007 (3:54 pm)
What exactly are you trying to achieve?

The above script will enable you to play animations if that's what you mean eg, %obj.playThready(0, "animation_sequence");
#5
05/14/2007 (3:58 pm)
If you look in your tree structure in the world editor, you will have two areas, one for the dynamic objects (shapes) and one for the static. dynamic is created through datablocks (code) and static, well is just placed in the shapes directory, they both reference the same file object though.
#6
05/14/2007 (7:15 pm)
Julian, I think that Hasitha is looking for a dynamic object in the realm of physics from what I have read. If this is the case Hasitha, you might want to do a search for Rigid Body Dynamics, ODE, ect. You could also just take a look at this resource - - link -
#7
05/15/2007 (8:21 pm)
@Alex- Exactly what I was looking for. Thanks!

@Julian- I think I was using the wrong terminology with the word 'dynamic'. I was assuming that dynamic objects have physics applied to them. Sorry, but thanks for replying anyways.

~Hasitha