How do I make client side renderable object?
by Konrad Wojton; · in Torque Game Engine · 11/05/2008 (9:56 am) · 5 replies
I'd like to write class which instances can exists only on client side and can render simple geometries from vertices.
I wrote it using this tutorial:
http://tdn.garagegames.com/wiki/Code/How_do_I_make_a_renderable_object%3F
and modified some lines and it works as I want, but instance of that class exists on server too.
So I found resource: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6504
and modified lines in constructor:
mTypeMask |= StaticObjectType | StaticTSObjectType | StaticRenderedObjectType;
mNetFlags.clear(Ghostable | ScopeAlways);
mNetFlags.set(IsGhost);
to:
mTypeMask |= StaticObjectType | StaticTSObjectType | StaticRenderedObjectType;
mNetFlags.set(Ghostable);
and in onAdd method:
addToScene();
to:
gClientContainer.addObject(this);
gClientSceneGraph->addObjectToScene(this);
And now I suppose that object exist on client side, I can't see it rendered but I know that renderObject method is called. Has anyone know what is wrong?
I wrote it using this tutorial:
http://tdn.garagegames.com/wiki/Code/How_do_I_make_a_renderable_object%3F
and modified some lines and it works as I want, but instance of that class exists on server too.
So I found resource: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6504
and modified lines in constructor:
mTypeMask |= StaticObjectType | StaticTSObjectType | StaticRenderedObjectType;
mNetFlags.clear(Ghostable | ScopeAlways);
mNetFlags.set(IsGhost);
to:
mTypeMask |= StaticObjectType | StaticTSObjectType | StaticRenderedObjectType;
mNetFlags.set(Ghostable);
and in onAdd method:
addToScene();
to:
gClientContainer.addObject(this);
gClientSceneGraph->addObjectToScene(this);
And now I suppose that object exist on client side, I can't see it rendered but I know that renderObject method is called. Has anyone know what is wrong?
About the author
#2
11/06/2008 (4:50 am)
Thanks for Your tutorial. I inserted Your files (happyFunSquiggleBall.h, happyFunSquiggleBall.cc) into my project and created this object in script. In effect I see it properly rendered on screen. So I changed it to client side only object and changed Your geometry to simple plane and it still worked fine. So in next step I bound a texture and now it is what I want :)
#4
11/06/2008 (4:56 am)
Oops... didnt see you already did it
#5
11/06/2008 (10:05 am)
Neat resource, i didn't know about that one. Thanks, James.
Associate Orion Elenzil
Real Life Plus
I wrote a tutorial which you might find useful.
It's called Happy Fun Squiggle Ball.