Does everything need a datablock.
by MK · in Torque Game Engine · 06/12/2002 (11:21 am) · 3 replies
I copied the camera class and stripped it down to the bare minimum, so that it can be created without any errors.
The struct for this has nothing left in it but Parent typedef, the DECLARE_CONOBJECT() and a consoleInit() function with nothing in it.
The class also has only very little of the original camera class as I don't need to change modes etc.
I can create the object in the game and fly around, and switch control object to the original camera, or the player and back to my camera, so I don't believe there are conflicts of any sort. But I have to declare it like this:
Where the datablock looks like:
because I don't need anything in the datablock. If I get rid of the datablock it doesn't work.
So, I tried to make a function like the 'aiAddPlayer' from aiplayer.cc. This fails on the 'onAdd()' function of my camera class, because it calls ShapeBase's onAdd(), which calls GameBase's onAdd(), which checks the mDataBlock variable, which in my case returns false.
How can I have my camera object without a datablock and preferably without the 'MyCamData' struct, as I don't see what its needed for.
I'd like to implement the loading code for the camera like aiplayer's 'aiAddPlayer' function, but if thats not possible, the normal way would suffice.
The struct for this has nothing left in it but Parent typedef, the DECLARE_CONOBJECT() and a consoleInit() function with nothing in it.
The class also has only very little of the original camera class as I don't need to change modes etc.
I can create the object in the game and fly around, and switch control object to the original camera, or the player and back to my camera, so I don't believe there are conflicts of any sort. But I have to declare it like this:
%this.mycam = new CMyCam()
{
dataBlock = myBlah;
};Where the datablock looks like:
datablock MyCamData(myBlah)
{
blah = "myBlah";
};because I don't need anything in the datablock. If I get rid of the datablock it doesn't work.
So, I tried to make a function like the 'aiAddPlayer' from aiplayer.cc. This fails on the 'onAdd()' function of my camera class, because it calls ShapeBase's onAdd(), which calls GameBase's onAdd(), which checks the mDataBlock variable, which in my case returns false.
How can I have my camera object without a datablock and preferably without the 'MyCamData' struct, as I don't see what its needed for.
I'd like to implement the loading code for the camera like aiplayer's 'aiAddPlayer' function, but if thats not possible, the normal way would suffice.
Torque Owner Jarrod Roberson
the datablock is nothing more than a Factory for instances of the C++ objects on the server, in this case the Camera object.
the datablock == CameraData or something similar, and it is used to instantiate the Camera object or whatever it is called, I don't have the source with me right now :(