getting other players' camera transform
by Matthew Franklin · in Torque Game Engine · 09/21/2002 (3:42 pm) · 2 replies
This is a pretty basic question, but I haven't been using Torque that long. What I want to do is get various other players' camera transforms. Currently, in script I listen to a client join message, and set a variable in a GUI control (subclass of gameTSCtrl). In my new class, I override processCameraQuery, and that's where I need the new camera transform.
My problem is that I can't figure out how to take something like a clientID or somesuch and get a camera transform from it. So I've resorted to getting the client name and iterating like so:
for (SimSetIterator itr(connection); *itr; ++itr)
{
if ((*itr)->getType() & ShapeBaseObjectType)
{
ShapeBase* shape = static_cast(*itr);
if(shape->getShapeName() && !strcmp(shape->getShapeName(), mClientName))
{
my code
}
}
}
This is not the most elegant solution, however. Is there a way to either declare a console variable to be a ShapeObject, or to do a direct lookup on clientID or clientName?
Thanks in advance.
My problem is that I can't figure out how to take something like a clientID or somesuch and get a camera transform from it. So I've resorted to getting the client name and iterating like so:
for (SimSetIterator itr(connection); *itr; ++itr)
{
if ((*itr)->getType() & ShapeBaseObjectType)
{
ShapeBase* shape = static_cast
if(shape->getShapeName() && !strcmp(shape->getShapeName(), mClientName))
{
my code
}
}
}
This is not the most elegant solution, however. Is there a way to either declare a console variable to be a ShapeObject, or to do a direct lookup on clientID or clientName?
Thanks in advance.
#2
http://garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3241
So I do need to get it client-side. I'll look into editing that command you mentioned. I originally went with a solution like you mentioned, but it only worked on the server, and the clients all crashed. I gave up there, but your suggestion gives me another place to look. Thanks!
09/21/2002 (4:36 pm)
Oops, I didn't make that clear. Actually, it's part of a script+code gameplay mod I'm working on; the in-progress version is up in the resources section at:http://garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3241
So I do need to get it client-side. I'll look into editing that command you mentioned. I originally went with a solution like you mentioned, but it only worked on the server, and the clients all crashed. I gave up there, but your suggestion gives me another place to look. Thanks!
Torque 3D Owner Luigi Rosso
This'll only work serverside though (if that's what you want then read no further :)), if you'd like for it to work clientside there's a few things you can do.
You can edit the console command (I think it's in shapeBase.cc, just search for it) so it doesn't check if it's being called on the server (isServerObject()). You'll need to pass it the local id of the object though not the server's one (you shouldn't have the server one client side anyway).
Otherwise you can make a simple server command which requests for a person's camera transform. You'd probably do that using names too so I don't think there'd be anything gained from what you're doing now.
You wouldn't use this for quick updating though (like a radar) :)
Hope that's what you were looking for.