Game Development Community

dev|Pro Game Development Curriculum

guiObjectView - Mountable Animated DTS Viewer

by Loonatik · 12/22/2002 (4:35 pm) · 56 comments

Download Code File

Install Steps:

1) Extract guiObjectView.zip into torque/

2) Do a clean build of torque

3) Extract objectViewExample.zip if needed



Usage:

"objectName" was used to identify an object, to allow you to reference it later on for things like setSequence.

// objectName, shape, skin, detail
view.setObject("objectName", "fps/data/shapes/object/object.dts", "", 0);
Sets the main object for the scene. Calling this again after the scene has a main object will cause everything to get unloaded and the new object to be loaded.

// objectName, shape, skin, parentNode, detail
view.mountObject("objectName", "fps/data/shapes/object/object.dts", "", "nodeName", 0);
Allows you to mount an object containing a node called mountPoint, to any node on the Main Object. Mounting an object to the same nodeName will cause the previous object to be unmounted.

// objectName, nodeName
view.unMountObject("objectName", "");
view.unMountObject("", "nodeName");
This allows you to unMount an object from the main object by either specifying the object name or the nodeName of the object.

// objectName, dsq
view.loadDSQ("objectName", "fps/data/shapes/object/object_animation.dsq");
This allows you to load dsq files for the specified object. Note: not all objects require you to load a DSQ to use thier sequence. An example would be the chaingun from tribes2.

// objectName, sequence, time
view.setSequence("objectName", "sequenceName", 1);
This allows you to run a sequence for the specified object. You can also control how fast or slow the sequence will play by using time.

//
view.setEmpty();
This clears the current scene of all objects.



Example:

Here is an example of how to load up a player object, mount a weapon and a pack. (saying you had these objects)

You can also animate mounted objects if they have sequences by using the same code that you did with player.

// Load the player up
view.setObject("player", "fps/data/shapes/player/player.dts", "", 0); // Example player, with default skin and detail level of 0
view.loadDSQ("player", "fps/data/shapes/player/player_root.dsq"); // Load up the root sequence
view.setSequence("player", "Root", 1); // Set the sequence to Root

// Mount the objects
view.mountObject("weapon", "fps/data/shapes/rifle/weapon.dts", "", "mount0", 0); // Example weapon with default skin and detail level of 0
view.mountObject("pack", "fps/data/shapes/pack1/pack.dts", "", "mount1", 0); // Example pack with default skin and detail level of 0

// Get rid of the pack
view.unMountObject("pack", ""); or view.unMountObject("", "mount1");

Todo:

* Better camera options are next, should be able to bust this out within a few days. I plan to add the ability to have it spin, and work on making it fit better.

* We really plan to expose all the animation options, including blending, multiple threads, and sound.

* Our other goal from this will be to create a Player Selection example. Which will allow people to pick a player model and customize its apperance and skin. Then allow you to load that customized object within the game.

About the author

Recent Blogs

Page«First 1 2 3 Next»
#41
06/15/2006 (11:43 am)
I was wondering if there was a way to place variables into the object section, like so..

CharStatsView.setObject("%race", "Felswourne/data/shapes/player/"@ %race @"/"@ %race @"_player.dts", "", 0);

For some reason it is chopping my variables right out of the path and file name.
#42
07/18/2006 (6:26 pm)
Loading object starter.fps/data/shapes/player/player.dts
Loading dsq starter.fps/data/shapes/player/player_jump.dsq
Error: Could not locate sequence jump
Error: Could not locate sequence jump

anyone got this problem
#43
07/24/2006 (1:14 pm)
Hi,
Are there any updates or newer versions for this control?
Guimo
#44
08/19/2006 (9:39 am)
Anyone get this ported to TSE?
Thanks
#45
02/26/2007 (6:44 pm)
What about spawning the player that is in the gui window with what weapons you have put on... Any help with that would be appreciated.
#46
02/27/2007 (3:37 pm)
Here is the answer to my above problem in case anyone else ever finds this post and has the same problem.... This tread explains it all...


http://www.jamestadeo.com/Games-by-James-Tadeo/torque/Torque-Tutorials/Torque-Player-Selection/Torque-Player-Selection.php#playerpreviewer
#47
10/27/2007 (10:17 am)
Hey anybody out there? Any advice on using the skin parameter of
view.setObject("player", "shape", "skin", 0);
it needs to be loaded as a tag using single quotes the way you use setSkinName('blue'), so I am lost on how to pass a tag to a string, because I cannot get it working as a tag or a string.
#48
10/27/2007 (10:43 am)
hm, i wrote this a while ago, but no longer understand it.
function makeTaggedString(%plainText)
{
   %cmd = "%ret = \"" @ expandEscape(%plainText) @ "\";";
   eval(%cmd);
   // echo("make tagged like this:" SPC %cmd);
   return %ret;
}

seems like it should be:
function makeTaggedString(%plainText)
{
   %cmd = "%ret = '" @ expandEscape(%plainText) @ "';";
   eval(%cmd);
   // echo("make tagged like this:" SPC %cmd);
   return %ret;
}
#49
10/27/2007 (11:23 am)
Orion my man! Once again you ride to the rescue. Thanks a lot for the quick response. I will have to try it later because today the Oregon Ducks play USC and if they win they are number 3 in the Pac-10. We are ready to boogie in Eugene today. Talk to you later.
#50
10/27/2007 (11:47 am)
always a pleasure! actually it seems like a weird place for a tagged string - afaik they only have value when moving the same string over the network several times. so another option would be to change the setObject() consoleMethod to just expect a normal string. Or better, make it so it deals with either.

anyhow, good luck w/ the game!

i'm off for a day picnicing on the coast!
#51
10/28/2007 (11:07 am)
@Orion; Color me purple the skin parameter is a skin file location. Whoa feel like a numb nut. But am still having a problem. This function takes a string which I got working. Once again thanks!!!
#52
04/09/2008 (1:13 am)
Just would like to let everyone know that this resource still works on 1.5.2 beautifully. I merely changed the location of the files to engine/gui/controls and updated them with the new location. :)

Below is a screen shot of this resource working in our new game Soul Wars.
www.novogeek.org/files/soulwars/windows/Main_Menu-001.png
#53
08/04/2008 (4:07 pm)
I really need to get this to work. So where do I put the code listed at the top?
#54
08/12/2008 (9:10 am)
great resource.. helps me a lot

Stephen Kelly

download archive with files, than just follow included guiObjectView.txt file..
#55
11/28/2008 (1:18 pm)
Is this compatible with Arcane FX? I did exactly what it said, but when I open the AFX-demo it doesn't have it in the new GUI dialog.
#56
11/26/2018 (2:40 am)
Sorry to necrobump this topic, but I'd really like a download for this asset for my tge game, I cannot find it anywhere else...
Page«First 1 2 3 Next»