Game Development Community

Valid Server Object Transform?

by Eric Roberts · in Torque Game Engine · 03/02/2006 (8:03 pm) · 3 replies

When does the server have a valid object transform (and not just the identity)?

This may seem like a silly question, but I've found the following:

In SceneObject, ::onAdd() has the identity matrix set up when it's a server object, but it has the correct matrix when it's a client object.

So where is the information coming from? And how does the client get it right, right away - but not the server? Looking at the callstack doesn't seem to help too much.

Thanks for your time,

- Eric

#1
03/15/2006 (12:36 am)
OnAdd is called on the server and client, FYI. And in the scene object onAdd, there's no special server/client code(same code gets run on both). It's probably also worth noting that stock SceneObjects don't actualy do any networking/ghosting, even though they are NetObjects.
#2
03/19/2006 (12:10 pm)
Yeah I know that onAdd is called on both the server and the client, and I was working with a derived object from sceneobject, and I set it up to be ghosted.

I think I figured out the problem with it though. Here's what I think is happening. If the object is created without an explicit transform (say creating it in the mission editor), it's onAdd method will be called first on the server object, then a call to setTransform on the server object. Then the information gets ghosted to the client and it's onAdd method is called with a proper transform.

So the server object may or may not have a transform on onAdd, but the client most definately will.

Thanks for your time.

- Eric
#3
03/19/2006 (12:18 pm)
Interesting thread; thanks eric.