Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,507 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
camera smooth turn prolem #373009
06/06/11 18:06
06/06/11 18:06
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
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;



Re: camera smooth turn prolem [Re: romin2011] #373057
06/07/11 08:31
06/07/11 08:31
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
Someone please?

Re: camera smooth turn prolem [Re: romin2011] #373068
06/07/11 10:33
06/07/11 10:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Quote:
the camera keeps turning doesn't stop reaching the target angle?

Describe your problem more precisely in different words.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: camera smooth turn prolem [Re: Superku] #373074
06/07/11 11:12
06/07/11 11:12
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
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.

Re: camera smooth turn prolem [Re: romin2011] #373088
06/07/11 13:20
06/07/11 13:20

M
mercuryus
Unregistered
mercuryus
Unregistered
M



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

Re: camera smooth turn prolem [Re: ] #373100
06/07/11 14:28
06/07/11 14:28
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
@mercuryus it still keeps rotating and doesn't stop frown

Re: camera smooth turn prolem [Re: romin2011] #373108
06/07/11 15:56
06/07/11 15:56

M
mercuryus
Unregistered
mercuryus
Unregistered
M



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);

}




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1