Client Side Objects ...
by Melv May · in Torque Game Engine · 03/13/2002 (12:41 pm) · 0 replies
Hi Folks,
I'm trying to get an object, that is server-side, to create a child object from it's ghost version on the client. I'm doing this as the server does not need to see the child object. The child object is a class derived from TSStatic.
Is it possible to add a TSStatic object to the ClientSceneGraph only?
In the parent->onAdd I check to see that the object is a ghost (client-side) then I proceed to create a TSStatic shape (actually a class based upon it) and use:-
childobj->registerObject("fubar");
on it. If I go into the game, it's not being rendered. If go into the editor then I can see the item. If I use "Tree();" in the console I find it under "GhostAlwaysSet" simset.
If I change the check (in parent->onAdd) to only create it on the server then all is well. It looks like the object is created then is ghosted which is not what I want. This child object does not need to move across the network.
Have I explained myself well???
Potential problems I can see is that during the TSStatic onAdd function a call is made to create a TSShapeInstance. The second parameter in the constructor for this is "loadMaterials". Unfortunately the call "isClientObject()" is being passed to it which answers "no". This should be YES!!! I guess I need to focus here.
The client-side code is something like ...
mClientShape = new fxClientShapeStatic();
mClientShape->SetShapeName("fps/data/shapes/organic/bush1.dts");
mClientShape->setPosition(NewPos);
mClientShape->registerObject("fubar");
If this is done on the ghosted (client-side) object, how can I force it to be client-side only???
If I use "mClientShape->addToScene();" then within the function is decides the object is a ServerObject...damn.
gClientContainer.addObject(mClientShape);
gClientSceneGraph->addObjectToScene(mClientShape);
Anyone?
I'm trying to get an object, that is server-side, to create a child object from it's ghost version on the client. I'm doing this as the server does not need to see the child object. The child object is a class derived from TSStatic.
Is it possible to add a TSStatic object to the ClientSceneGraph only?
In the parent->onAdd I check to see that the object is a ghost (client-side) then I proceed to create a TSStatic shape (actually a class based upon it) and use:-
childobj->registerObject("fubar");
on it. If I go into the game, it's not being rendered. If go into the editor then I can see the item. If I use "Tree();" in the console I find it under "GhostAlwaysSet" simset.
If I change the check (in parent->onAdd) to only create it on the server then all is well. It looks like the object is created then is ghosted which is not what I want. This child object does not need to move across the network.
Have I explained myself well???
Potential problems I can see is that during the TSStatic onAdd function a call is made to create a TSShapeInstance. The second parameter in the constructor for this is "loadMaterials". Unfortunately the call "isClientObject()" is being passed to it which answers "no". This should be YES!!! I guess I need to focus here.
The client-side code is something like ...
mClientShape = new fxClientShapeStatic();
mClientShape->SetShapeName("fps/data/shapes/organic/bush1.dts");
mClientShape->setPosition(NewPos);
mClientShape->registerObject("fubar");
If this is done on the ghosted (client-side) object, how can I force it to be client-side only???
If I use "mClientShape->addToScene();" then within the function is decides the object is a ServerObject...damn.
gClientContainer.addObject(mClientShape);
gClientSceneGraph->addObjectToScene(mClientShape);
Anyone?
About the author