Game Development Community

Using GuiPlayerView to show a model

by Sean Kerr · in Torque Game Engine · 02/17/2004 (7:40 am) · 14 replies

I'm making an attempt at using GuiPlayerView to show a model.

Here's the GUI I have currently:

new GuiChunkedBitmapCtrl(MainMenuGui)
{

    profile     = "GuiDefaultProfile";
    horizSizing = "width";
    vertSizing  = "height";
    position    = "0 0";
    extent      = "640 480";
    minExtent   = "8 8";
    visible     = "1";
    helpTag     = "0";
    bitmap      = "~/images/background";
    useVariable = "0";
    tile        = "0";

    new GuiPlayerView(PlayerView)
    {

        profile     = "GuiDefaultProfile";
        horizSizing = "relative";
        vertSizing  = "relative";
        position    = "100 100";
        extent      = "300 350";
        minExtent   = "8 8";
        visible     = "1";
        helpTag     = "0";
        cameraZRot  = "0";
        forceFOV    = "40";

    };

};

And here's the code I'm using to set the model I want to show:

function loadModel (%model, %anim)
{

    %model = "base/shapes/" @ %model;
    %anim  = "base/shapes/" @ %anim;

    PlayerView.setModel(%model, %anim);
    Canvas.repaint();

}

The model and animation load, and I know this because if I set an incorrect path for either one, I get an error in the console. But for some reason, the model isn't showing up. Is there a GuiPlayerView function I need to call to tell it to render the model? I'm taking code examples from RealmWars and I don't see any other code being called other than setModel().

#1
02/17/2004 (9:49 am)
I did end up getting a model to load into my GUI by compiling the code from tutorial: http://perso.wanadoo.fr/hysteria/docs/guiCtrls.htm

How hard would it be to add in animation support?
#2
02/17/2004 (10:01 am)
Sean

The Playerview takes 3 params model,skin,anim
So to load a model in it you need this
%model = "fps/data/shapes/player/player.dts";
%skin  = "if you have one ";
%anim  = "fps/data/shapes/player/player_root.dsq";

PlayerView.setmodel(%model,"",%anim);
#3
02/17/2004 (10:44 am)
Billy,

The RealmWars developers altered the engine code to take three parameters. The Torque source only takes two.

It has commented code to load a sequence, which I've tried to move over to my guiObjectView.cc, and I successfully have it compiling, but the animation will not run. I'm still unsure of what TSShape::findSequence(const char*) takes. I don't know if it's an absolute file-system path or just a name, or just a sequence name associated with the model. TSShape::findSequence() also has another version that takes an integer, but once again I'm not sure what it is.
#4
02/17/2004 (1:14 pm)
Sean

Sean i tried this in the head and i cant get it to work for
now.
I dont get any errors but i dont see any model.
I use the rw playerview i think!? :)
#5
02/17/2004 (1:29 pm)
The guiPlayerView gui is broken, but you could use the guiObjectView which you can find in the resources, I use this and it is extremely flexably.
#6
02/17/2004 (5:44 pm)
Joshua,

I do use the guiObjectView now. I've compiled it into the engine. However, it has no animation support and I'd like to view models with animations.
#7
02/17/2004 (6:56 pm)
Thanks for the help everybody. I finally got models loading and animations running.
#8
02/17/2004 (8:01 pm)
Could you post how for future reference?
#9
02/18/2004 (5:21 am)
I downloaded the custom guiObjectView from here:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3659

I added it to my VC++ project and recompiled the engine. Then I used the examples in the downloaded .zip file to load what I needed. It took almost no effort.
#10
04/04/2005 (10:40 pm)
If guiPlayerView still doesnt work in head, and guiObjectView does, why is it being included instead of guiObjectView?
#11
02/07/2006 (12:10 pm)
It does work now (1.4)
#12
02/15/2006 (4:23 am)
In my game guiPlayerView shows the player, but I can't play any animation: the function setSeq(index) is the way ( I think ) but it doesn't work. Why?

note: I have Torque 1.4
#13
03/14/2006 (9:35 am)
So, like, does this work or not? lol.

I would like to use stuff that dosn't make me re-compile.
#14
02/26/2007 (5:14 pm)
I trie d playerview.setModel(%dtsFile,"");, not working