Game Development Community

RTS Camera - contraining movement

by James · in RTS Starter Kit · 08/08/2006 (4:06 am) · 2 replies

I've been modifying (or at least trying to) the RTS Camera with only a little luck.
What I've looking to do is constrain the angle the camera can look up and down (Pitch) and how high it can go above the terrain.

In RTSCamera.cc I've found what I thought would allow me to make these adjustments.
RTSCameraData::RTSCameraData()
{
   mMovementSpeed = 40;
   mPitchAngle    = 90;

   mMaxOrbitHeight = 1000;
   mMinOrbitHeight = 5;
   mOrbitStep = 10;
   mMaxAngle = 90;
   mMinAngle = 20;
   mAngleStep = 5;
}
But only adjusting the step variables seems to have any affect. I've even gone as far as to place zeros in all the other variables to see if it breaks but with no effect.

Any suggestions or pointers will be greatly appreciated.

Cheers!

edit - typo

#1
08/08/2006 (11:09 am)
You don't need to modify the values in RTSCamera.cc, modify them in camera.cs. I don't have the RTSStarterKit accessible right now, but in TGE1.4 camera.cs is at SDK/example/GameFolder/server/camera.cs. In that, you will find code that looks similar to:
datablock RTSCameraData(RTSObserver)
{
   mode = "RTSObserver";
   movementSpeed = 80.0;
   pitchAngle    = 90.0;
   yawAngle      = 0.0;
   maxZoom = 100.0;
   minZoom = 5;
   zoomStep = 5;
   maxAngle = 90;
   minAngle = 5;
   angleStep = 5;
};
I have modified the RTSCamera heavily, so your variables will not be the same. But if you adjust those values, the changes should take effect (remember to delete the .dso).
#2
08/08/2006 (11:27 am)
Thanks Justin - I was about to post I'd found the file and made the adjustments. Much appreciate the help all the same. I may bug you again before the weeks out :)