camera smooth turn prolem

Posted By: romin2011

camera smooth turn prolem - 06/06/11 18:06

Hello!
This code smoothly turns an entity toward target entity, but if i use it to turn the camera smoothly toward the target entity(turn the camera independent of any player etc) the camera keeps turning doesn't stop reaching the target angle?

Code:
VECTOR a,b;
vec_diff(a,cover.x,my.x);
vec_to_angle(b,a);
camera.pan+=ang(b.x-my.pan)*0.3*time_step;


Posted By: romin2011

Re: camera smooth turn prolem - 06/07/11 08:31

Someone please?
Posted By: Superku

Re: camera smooth turn prolem - 06/07/11 10:33

Quote:
the camera keeps turning doesn't stop reaching the target angle?

Describe your problem more precisely in different words.
Posted By: romin2011

Re: camera smooth turn prolem - 06/07/11 11:12

The player runs toward cover once reached he turns oposite the wall. The camera should now smoothly turn to face player(not behind him, it is wall behind him).
I hope i could describe the situation.
Posted By: Anonymous

Re: camera smooth turn prolem - 06/07/11 13:20

camera.pan+=(ang(b.x)-ang(my.pan))*0.3*time_step; // maybe - can remember i once had such a problem...
Posted By: romin2011

Re: camera smooth turn prolem - 06/07/11 14:28

@mercuryus it still keeps rotating and doesn't stop frown
Posted By: Anonymous

Re: camera smooth turn prolem - 06/07/11 15:56

found this... maybe it helps

Code:
// turn an object to an destination
function turnto(ENTITY* pe, var* ppos, var* p_speed){
var lva[3];
	
	vec_set(temp, ppos[0]);	
	vec_sub(temp, pe.x);
	vec_to_angle(lva[0], temp);
	c_rotate(pe, vector(ang((lva[0])-(pe.pan))*p_speed[0]*time_step, ang((lva[1])-(pe.tilt))*p_speed[1]*time_step, ang((lva[2])-(pe.roll))*p_speed[2]*time_step), IGNORE_ME|IGNORE_PASSABLE);

}


© 2024 lite-C Forums