How to zoom in and out (Solved)

Posted By: Elektron

How to zoom in and out (Solved) - 03/03/10 04:43

How to zoom in and out on publish mode with keys w and s like lite-c after press 0 key?

Thanks in advance
Posted By: 3run

Re: How to zoom in and out - 03/03/10 06:07

Think you mean simple zooming... Here you go:
Code:
function zoom()
{
    if(key_w)
   { 
     camera.arc -=time_step*15;
   }
   if(key_s) 
   {
     camera.arc +=time_step*15;
   }
   camera.arc = clamp(camera.arc,30,80); // play with 30 and 80
}


Call this function inside the player while loop. Hope could help laugh Good luck
Posted By: MrGuest

Re: How to zoom in and out - 03/04/10 01:10

If you mean moving the camera around without going into debug, look at default.c

Code:
void def_move()
{
	VECTOR force,speed,dist;
	ANGLE aforce,aspeed; 

// initialize speed and distance
	vec_zero(speed);
	vec_zero(aspeed);
	vec_zero(dist);

    if (1 > def_camera)
        def_camera = 1;
	if (1 < run_mode && run_mode < 5) 
		def_camera = 2;	// prevent player movement in entity viewer mode

	while (def_camera) 
	{
        aforce.tilt = 5*(key_pgup - key_pgdn + mouse_right*mouse_force.y);
        if (key_alt==0) {
            aforce.pan = -5*(key_force.x + mouse_right*mouse_force.x + joy_force.x);
            aforce.roll = 0;
        } else {
            aforce.pan = 0;
            aforce.roll = 5*(key_force.x + mouse_right*mouse_force.x + joy_force.x);
        }

		vec_add(camera.pan,vec_accelerate(dist,aspeed,aforce,0.8));

        force.x = 7*(key_force.y + key_w - key_s + joy_force.y);
        force.y = 3*(key_comma - key_period + key_a - key_d);
        force.z = 3*(key_home - key_end);
        vec_accelerate(dist,speed,force,0.5);

is the main part of it laugh
Posted By: Elektron

Re: How to zoom in and out - 03/06/10 00:11

Thank you MrGuest.
It was what i was looking for.
You know how to change the speed of zoom?
Posted By: MrGuest

Re: How to zoom in and out - 03/06/10 22:59

Code:
force.x = 7*(key_force.y + key_w - key_s + joy_force.y);
        force.y = 3*(key_comma - key_period + key_a - key_d);
        force.z = 3*(key_home - key_end);
        vec_accelerate(dist,speed,force,0.5);

is the part you'll need to change
force.x = 14* will obviously be twice as fast
or change it to a variable and have the user define it

Code:
var cam_speed
...
force.x = cam_speed*(key_force.y ...
...

void cam_speed_up(){
   cam_speed++;
}
void cam_speed_down(){
   cam_speed--;
}

on_x = cam_speed_up;
on_z = cam_speed_down;



hope this helps
Posted By: Elektron

Re: How to zoom in and out (Solved) - 03/07/10 11:53

Yes, that helped a lot laugh
Thank you very much.
© 2024 lite-C Forums