View Full Version : Camera motion problem.. Help please.
12-11-2003, 01:05 PM
Does anyone know if it is possible to get a smooth camera motion with acceleration? if so would you be so kind as to point me in the right direction please? I have a camera that is using gluLookAt but when moving with the keyboard it appears blocky!
12-11-2003, 01:10 PM
Should perhaps have said im using VC++ 6.. Thanks...
12-11-2003, 02:09 PM
Easy if you think of it physically :
Define position, speed and time as globals.
Key events :
when key X is down, swith a flag on.
when key X is down, swith the flag off.
Main render loop:
new_time = getTime();
delta_time = new_time - time;
time = new_time;
. if (flag) then acceleration =1 //or whatever
. speed = speed + acceleration * delta_time
. if (speed > 10) then speed =10
. position = position + speed * delta_time
And if you want to stop gradually after releasing the key, just add a small friction force.
All of this is not really GL related, more general programming you know.
[This message has been edited by ZbuffeR (edited 12-11-2003).]
12-11-2003, 02:17 PM
Thanks for your response, i will be sure to try it in the morning and will let post back if i encounter any problems.. Once again, thanks..
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.