problem with switching camera objects
by William Swilling · in Torque Game Engine · 03/18/2010 (9:11 am) · 2 replies
In my game, I am constantly switching player view between multiple cameras placed around the terrain. Whenever I call setCameraObject(), there is a non-smooth (not immediate) transition to the next camera. It seems that for a frame or two, it shows a view from the player's feet or inside its head. Sometimes, it renders a view below the terrain. I found a piece of code in the readPacket() method of the GameConnection class that sets the camera object to NULL, returning view to the player's default camera:
When I commented out the last two lines, it made the camera transitions better, but they are still sometimes jarring. I cannot figure out what to do to make these transitions always occur immediately. Anyone have any ideas here?
if (bstream->readFlag())
{
S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
ShapeBase* obj = static_cast<ShapeBase*>(resolveGhost(gIndex));
setCameraObject(obj);
obj->readPacketData(this, bstream);
}
//else
// setCameraObject(0);When I commented out the last two lines, it made the camera transitions better, but they are still sometimes jarring. I cannot figure out what to do to make these transitions always occur immediately. Anyone have any ideas here?
#2
03/18/2010 (11:24 am)
I want player control to remain with the Player object. I just want the viewpoint to switch between multiple cameras. If I setControlObject on the cameras, the player would now be moving the camera instead of the Player object.
Torque 3D Owner Thomas Bang