Modifying the camera
by Justin Mosiman · in RTS Starter Kit · 06/20/2006 (10:32 pm) · 1 replies
Hello,
I'm trying to modify the default RTSCamera so that for example when you decrease your orbit distance, the camera zooms in on the center of the screen instead of just changing the height. Right now I am starting with the basics, and am already having some problems.
I have modified RTSCamera::increaseOrbitDistance() to the following, just to see if my changes would take effect:
But this code doesn't even work. All that I am expecting it to do is change positions to a static 100,100, but the camera acts like nothing has been done with setCameraPosition.
What am I missing?
Thanks,
Justin
edit: I mentioned decrease orbit distance but in my code I have increase, it doesn't really matter, either way the camera isn't changing positions.
I'm trying to modify the default RTSCamera so that for example when you decrease your orbit distance, the camera zooms in on the center of the screen instead of just changing the height. Right now I am starting with the basics, and am already having some problems.
I have modified RTSCamera::increaseOrbitDistance() to the following, just to see if my changes would take effect:
void RTSCamera::increaseOrbitDistance()
{
Point2F curPos = Point2F(100,100);
setCameraPosition(curPos);
setOrbitDistance(getOrbitDistance() + mDataBlock->mOrbitStep, true);
}But this code doesn't even work. All that I am expecting it to do is change positions to a static 100,100, but the camera acts like nothing has been done with setCameraPosition.
What am I missing?
Thanks,
Justin
edit: I mentioned decrease orbit distance but in my code I have increase, it doesn't really matter, either way the camera isn't changing positions.
Torque Owner Justin Mosiman
Opsive
Thanks,
Justin
Edit: Nevermind it working when you directly set mTargetPos, that camera was just moving back to its default position, hence it only moving once.