Game Development Community

TSShapeConstructor

by Eric den Boer · in Torque 3D Professional · 07/19/2009 (6:55 am) · 5 replies

Hi,

Monster-n00b question, but... what exactly does TSShapeConstructor do? What's it good for? I read the documentation and as far as I can see you can add shapes to shapes? Isn't that the same as %shape.mountImage(..); ?

:D

#1
07/19/2009 (7:23 am)
Players are TSShapeConstructor shapes, so I reckon it's basically a dynamic object which you can the most things with. It has a huge list of readily available functions in dump().

edit
From the docs ... which aren't entirely correct on this section at the moment
Quote:
This document describes extensions to TSShapeConstructor which allow dynamic modification of a loaded 3space shape such as adding and manipulating nodes, geometry and sequences. The additional functionality is available by defining a TorqueScript function that is called when the TSShapeConstructor datablock is loaded as shown below.
#2
07/19/2009 (7:30 pm)
Quote:what exactly does TSShapeConstructor do?

It allows you to modify a DTS (or DAE) shape after it is loaded into memory. For example, by adding or renaming nodes, adding sequences (from DSQs) or adding collision and LOS meshes.

Quote:What's it good for?

The classic use case is for sharing animations with a number of character models. Say you have a set of DSQ animation files: run.dsq, jump.dsq, die.dsq, TSShapeConstructor lets you share these animations with any character model that has a compatible skeleton.

Other uses are:
- Adding/renaming nodes in a model not created specifically for Torque. For example, adding the 'eye', 'cam' and 'mount' nodes needed for Player shapes.

- Splitting animation sequences in a Collada file (since most Collada exporters put all animations into a single sequence on export).

- Adding a collision mesh to a model.

Quote:I read the documentation and as far as I can see you can add shapes to shapes? Isn't that the same as %shape.mountImage(..); ?

Not the same. TSShapeConstructor lets you add new meshes to your shape, which means you can set up different detail levels - both visible and collision/LOS. The resulting in-memory model can be used with any object class, including TSStatic.

%shape.mountImage attaches a model to your ShapeBase derived object. You have no control over detail levels and cannot use this command with TSStatic objects.
#3
07/19/2009 (7:33 pm)
Quote:Players are TSShapeConstructor shapes, so I reckon it's basically a dynamic object which you can the most things with.

Whilst TSShapeConstructor is often used with Player models, it has nothing to do with the Player object class.

TSShapeConstructor is like a scriptable post-export step that lets you prepare a model for use with some other object class (Player, StaticShape, TSStatic etc).
#4
07/19/2009 (8:34 pm)
Quote:prepare a model for use with some other object class
Gotcha, StaticShape category promptly added to my object editor's library. Now I realise what I was doing wrong previously.
#5
07/19/2009 (8:41 pm)
See the Docs are not clear for newbies