Game Development Community

Camera as control object checksum disagree

by Jari · in Torque Game Engine · 03/20/2006 (5:04 am) · 2 replies

Hi,
I modified the FPS demo scripts so that instead of creating player only camera is created and the camera is set as controlling object using call to setControlObject(). This works except that the engine reports "packetDataChecksum disagree!" and in this case it has the side effect that client keeps resetting the control object - until I rotate the camera. So after the camera is rotated everything is normal but before that the packet checksums disagree.

I noticed that there are two lines which are causing the disagreenment:

void Camera::readPacketData(GameConnection *connection, BitStream *bstream)
{
   Parent::readPacketData(connection, bstream);
   Point3F pos,rot;
   mathRead(*bstream, &pos);
   bstream->setCompressionPoint(pos);
   bstream->read(&rot.x); // this one and the one below
   bstream->read(&rot.z); // if you comment these lines out the packet checksum wont disagree any more

  // of course you would have to comment out the matching two lines in writePackedData
 // and of course the rotation doesnt work after you comment them out so this is not an fix

So, any ideas why writing/reading the rotation causes the packets checksum to disagree until user rotates the camera first time after it has been set as controlling object?

Thank you.

Jari.

#1
03/20/2006 (7:02 am)
Did you call setTransform and give the camera a position before setting it as your control object? If you just modified the the Starter FPS, try adding "%this.camera.setTransform(pickSpawnPoint());" before you set it as the control object (I'm assuming the location you're setting it as the control object).
#2
03/20/2006 (9:56 am)
No I didn't but I tested if that helps but it didnt. Thanks for the idea though!

The camera was placed at the origin with all rotation at zero, however I also tested what happens if the camera's initial rotation is something else than zero (hardcoded the change) but the problem remains.

It looks like that only first move packet that has rotation (yawn or pitch) makes the checksum disagreenment go away. It's strange that even I would move the camera around but wouldnt rotate it the packets still disagree.

Jari.