camera calculations

Posted By: Mare

camera calculations - 12/31/07 19:43

Hi there, im a new guy in this forum, but i have a simple knowlage about the Game Studio, so u dont need to explain to me as simple as u can Now the question: We all know that the pan value of an entitys orientation ranges from 0 to 360. Im using a simple code for calculating the camera position:
Code:
camera.x = my.x - camera_dist * cos(camera.pan);
camera.y = my.y - camera_dist * sin(camera.pan);
camera.z = my.z + 50;

camera.pan +=(my.pan - camera.pan) / 10 * time_step; // this is used to smooth the camera movement!!!
camera.tilt = my.tilt - 20;



This code works whel but when the pan value of the my entity goes like this:

359 -> 360 -> 0;

The camere spins around. Is there a solution to this problem? I know that it worked fine with older versions of GameStudio because the pan ,roll, and tilt were not clamped..
Thx for all answers!!
Posted By: Mare

Re: camera calculations - 01/02/08 14:19

Sorry guys, I know you are borred of me, and my dumb question!! But is there a camera movement script that makes the camera folow the entity smoothly? I have ran out of solutions. I mean the script that I have made makes the player look on the character from one single angle thru the whole level..... You know what I mean. Its a racing game, that I am making, and when I want to turn left or right the camera rigidly folows the car, it just destroys the feal that you are actually turning. Pleaseee help!!!

Posted By: xXxGuitar511

Re: camera calculations - 01/02/08 15:06

camera.pan += ang(my.pan - camera.pan) / 10 * time_step;
Posted By: Mare

Re: camera calculations - 01/02/08 17:11

thnx a lot man!!!
© 2024 lite-C Forums