Game Development Community

objectViewExample doesn't work issue for TGEA 1.7.1 or later version

by ccljyc · in Torque Game Engine Advanced · 03/18/2009 (11:03 pm) · 4 replies

I try to add this before setModel then see the Model shows up
// objectName, shape, skin, detail
view.setObject("SpaceOrc", "~/data/shapes/players/SpaceOrc/SpaceOrc.dts", "", 0);
Does any one can full fix it ?
I just try to fix now.

#1
03/20/2009 (8:26 pm)
I got some error as below.
scriptsAndAssets/client/scripts/objectViewExample.cs (21): Unknown command setObject.
  Object view(1415) view -> GuiObjectView -> GuiTSCtrl -> GuiContainer -> GuiControl -> SimGroup -> SimSet -> SimObject

scriptsAndAssets/client/scripts/objectViewExample.cs (35): Unknown command loadDSQ.
  Object view(1415) view -> GuiObjectView -> GuiTSCtrl -> GuiContainer -> GuiControl -> SimGroup -> SimSet -> SimObject
#2
03/20/2009 (8:29 pm)
My Script
view.setObject("SpaceOrc", $defaultGame @ "/data/shapes/players/SpaceOrc/SpaceOrc.dts", "", 0);

view.setModel($defaultGame @ "/data/shapes/players/SpaceOrc/SpaceOrc.dts");

view.loadDSQ("player","~/data/shapes/players/animations/player_root.dsq");
The setModel is successful.
#3
03/20/2009 (9:52 pm)
I found rename API from GuiObjectView
and got working.
//-----------------------------------------------------------------------------
// Console stuff (GuiObjectView)
//-----------------------------------------------------------------------------

IMPLEMENT_CONOBJECT(GuiObjectView);

ConsoleMethod(GuiObjectView, setModel, void, 3, 3,
              "(string shapeName)\n"
              "Sets the model to be displayed in this control\n\n"
              "\param shapeName Name of the model to display.\n")
{
   argc;
   object->setObjectModel(argv[2]);
}

ConsoleMethod(GuiObjectView, setSeq, void, 3, 3,
              "(int index)\n"
              "Sets the animation to play for the viewed object.\n\n"
              "\param index The index of the animation to play.")
{
   argc;
   object->setObjectAnimation(dAtoi(argv[2]));
}

ConsoleMethod(GuiObjectView, setMount, void, 4, 4,
              "(string shapeName, int mountPoint)\n"
              "Mounts the given model to the specified mount point of the primary model displayed in this control.\n\n"
              "\param shapeName Name of the model to mount."
              "\param mountPoint Index of the mount point to be mounted to. Corresponds to \"mountPointN\" in your shape where N is the number passed here.")
{
   argc;
   object->setMountedObject(argv[2], dAtoi(argv[3]));
}

ConsoleMethod(GuiObjectView, setOrbitDistance, void, 3, 3,
              "(float distance)\n"
              "Sets the distance at which the camera orbits the object. Clamped to the acceptable range defined in the class by min and max orbit distances.\n\n"
              "\param distance The distance to set the orbit to (will be clamped).")
{
   argc;
   object->setOrbitDistance(dAtof(argv[2]));
}
#4
12/30/2009 (8:58 am)
Bit of a late reply, but if you're still stuck on this...

view.setObject doesn't exist, use

view.setModel