Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Submiting: 3d person camera - orbiting around play #48815
07/06/05 19:01
07/06/05 19:01
Joined: Apr 2005
Posts: 196
In a far, far away galaxy
EPATATA Offline OP
Member
EPATATA  Offline OP
Member

Joined: Apr 2005
Posts: 196
In a far, far away galaxy
I'm proudly presents to you my 3d person camera that orbits around player based on mouse movements. Before the code works, make sure your player rotate around itself (pan orientation). So here we go!

Quote:


function follow_camera()
{
proc_late();
while(!player){wait(1);}
while(1)
{
camera.pan=player.pan; //set camera orientations
camera.tilt=max(-90,min(camera.tilt+(mouse_force.y*mouse_sensity),90));
camera.roll=0;

vec_set(temp,nullvector);
temp.x=-200; //put camera 200 quants behind player
vec_rotate(temp,camera.pan);
vec_add(temp,player.x);

trace_mode=ignore_passable+ignore_passents+ignore_models+ignore_sprites;
result=trace(player.x,temp.x); //do a trace from player to temp (where camera should be)
if(result==0){vec_set(camera.x,temp.x);} //nothing hits
else
{
if(result<0){vec_set(camera.x,player.x);} //inside a block?
else
{
vec_set(temp2,nullvector);
temp2.x=-max(vec_dist(player.x,target.x)-13,0);
vec_rotate(temp2,camera.pan);
vec_add(temp2,player.x);
vec_set(camera.x,temp2.x); //if you prefer, eliminate above lines and just write: vec_set(camera.x,target.x);
}
}

temp=vec_dist(camera.x,player.x);
if(temp<100){player.transparent=on;player.alpha=max(40,min(temp,100));}
else{player.transparent=off;player.alpha=100;}
wait(1);
}
}





Just call it at the beginning of your player action
Really cool huh?
This is my first contribution, hope it helps



If you dont believe in God then look at the sun. He makes blind those who only believe seeing.
Re: Submiting: 3d person camera - orbiting around play [Re: EPATATA] #48816
07/07/05 03:21
07/07/05 03:21
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline

Senior Expert
Orange Brat  Offline

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
It's one of the better 3rd person chase cams for someone who needs one. My only beef is that the camera clips into walls at first but then again they all do.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Submiting: 3d person camera - orbiting around play [Re: Orange Brat] #48817
08/17/05 23:39
08/17/05 23:39
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Hi EPATATA,
cant get your script to work.
temp2,? wheres that defined
mouse_sensity? wheres that defined..
etc.
Could you please update your script,
Cheers.


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | 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