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.