|
|
A smooth camera script?
#125761
04/23/07 02:51
04/23/07 02:51
|
Joined: Mar 2007
Posts: 677 0x00000USA
MrCode
OP
User
|
OP
User
Joined: Mar 2007
Posts: 677
0x00000USA
|
I tried this "experiment" as a code to rotate the camera with the mouse: Code:
function mouse_look() { while(1) { if (mouse_left== on) { camera.pan= pointer.x * -1 * time_step; camera.tilt= pointer.y * -1 * time_step; } wait(1); } }
It works (kind of), but how would I go about making it smoother? (And, it stops where the invisible cursor stops on the edges of the screen. Can I make it return to the other side somehow?)
void main()
{
cout << "I am MrCode,";
cout << "hear me roar!";
system("PAUSE");
}
|
|
|
Re: A smooth camera script?
[Re: MrCode]
#125764
04/23/07 04:17
04/23/07 04:17
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
in main function Code:
mouse_mode = 0;
some vars Code:
var mous_hor; var mous_vert;var my_target[3]; in camera loop function Code:
MOUSE_POS.X = POINTER.X; MOUSE_POS.Y = POINTER.Y; mous_hor = (pointer.x - ((screen_size.x )/2)) *-0.01; mous_vert = (pointer.y - ((screen_size.y )/2)) *-0.01; temp.x = MOUSE_POS.x; temp.y = MOUSE_POS.y; temp.z = 100; vec_for_screen(temp,CAMERA); vec_set(my_target.x, temp); vec_set(temp, my_target.x); vec_sub(temp,camera.x); vec_to_angle(camera.pan, temp); Try something like this... but not tested...
Last edited by tompo; 04/23/07 04:18.
Never say never.
|
|
|
|