Game Development Community

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:

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.

#1
06/24/2006 (7:29 pm)
I've done a lot to try to solve this problem, but I haven't been able to. Does anybody have any ideas? The closest that I've gotten was to set mTargetPos (both x and y) to a value (such as mTargetPos += 100) but it would only move once. I don't have any idea on why it would only move once.

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.