Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Akow), 1,403 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Question about vec_rotate() #431402
10/15/13 18:31
10/15/13 18:31
Joined: Apr 2012
Posts: 62
wrekWIRED Offline OP
Junior Member
wrekWIRED  Offline OP
Junior Member

Joined: Apr 2012
Posts: 62
I'm making a 1sr person flight combat game. Now camera roll, tilt, pan would rotate allot but I would also want to use a free rotation for the camera without losing it's current angle.
Really don't know how rotate works so I use this code.

Code:
var cam[3];
		cam[1] -= mouse_force.x * 4;
		cam[2] += mouse_force.y * 4;
		cam[3] = 0;
		vec_rotate(vector(cam[1],cam[2],cam[3]), vector(player.pan, player.tilt, player.roll));
		camera.pan = cam[1];
		camera.tilt = cam[2];
		camera.roll = cam[3];



only thing is every time I switch to free cam view the camera angle goes back to normal and rotates on it's usual angle and not the base on player's angle which means I'm not doing it right. Any help?

Re: Question about vec_rotate() [Re: wrekWIRED] #431405
10/15/13 19:12
10/15/13 19:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
What I would try is something as follows:

VECTOR cam_angle;

cam_angle.x -= mouse_force.x*4*time_step;
cam_angle.y += mouse_force.x*4*time_step;
cam_angle.z = 0;
vec_set(camera.pan,cam_angle);
ang_rotate(camera.pan,player.pan); // should be the right command, but I oftentimes confuse it
offset camera in vec_rotated negative x-direction


"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

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