Game Development Community

Starting the camera with pitch

by Peter Simard · in Torque Game Engine · 06/14/2006 (2:02 am) · 2 replies

What I thought would be a simple fix, has turned into a nightmare. Currently, when the player spawns the 3rd person camera is parallel with the ground. I would like to start the camera slightly over the players shoulders. Anyone know where would be the best place to change this? Ive tried tracing it through but cant come up with anything.

Thanks

#1
06/14/2006 (2:33 am)
Yeah in the Player::getCameraParemeters function. Here's the one I use, I added a couple variables to the player datablock so I can specify both a z and x offset (the y offset tries to stay at whatever cameraMaxDist is set to).

void Player::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
{
   if (!mControlObject.isNull() && mControlObject == getObjectMount()) {
      mControlObject->getCameraParameters(min,max,off,rot);
      return;
   }
   const Point3F& scale = getScale();
   *min = mDataBlock->cameraMinDist * scale.y;
   *max = mDataBlock->cameraMaxDist * scale.y;

   //Apply Z offset
   off->set(0,0,mDataBlock->cameraZOffset);

   //Apply X Offset
   MatrixF mat;
   Point3F rightVec;
   getEyeTransform(&mat);
   mat.getColumn(0, &rightVec);
   rightVec *= mDataBlock->cameraXOffset;

   *off += (rightVec);                       // Add it into our existing up offset
   
   rot->identity();
}

Though I thinkI should add min/max values for the x/z offsets eventually, since I think that's what the camera collision uses to determine how far to move. Haven't really looked into that much yet though.
#2
06/14/2006 (2:55 am)
Hi Paul, thanks for the reply. It looks like this code will only change the position not rotation. I am looking to pitch the camera up (like if you moved the mouse up with free look on).