well ... it isnt uber but it is alittle fun, anyways I'm working on this code
for a game of mine and I found that at some point the character needs to become transparent so you can still see where your crosshair is aimimg.
Hard for me to explain what I'm meaning-here's the code.
action player1
{
ct_45=my;
vec_for_vertex(temp, my, 218); //get temp the position of vertex #218 on this model
var movement_speed = 30; // movement speed
player = my; // I'm the player
my.invisible = off;
my.skill40 = 100; // let's store the health in skill40
while (my.skill40 > 0)
{
//camera
player.pan -= 25 * mouse_force.x * time;
camera.diameter=0; //this makes the camera passable
camera.genius=null;
vec_set(cam_centre.x,player.x); //setting new camera eye height
cam_centre.z+=(player.max_z*char_eye_height); //setting new camera centre
//calulate the xyz position of the camera
orbit_camera_dist = cos(orbit_camera_tilt)*camera_dist;
cam_pos.x = cam_centre.x - cos(player.pan)*orbit_camera_dist + 25;
cam_pos.y = cam_centre.y - sin(player.pan)*orbit_camera_dist;
cam_pos.z = cam_centre.z + sin(orbit_camera_tilt)*camera_dist;
//set pan,roll and tilt of the camera
camera.pan = player.pan;
camera.roll = 0; //zero roll
camera.tilt = -orbit_camera_tilt;
//this will tilt the camera on the y-axis of the character when the mouse is moved up/dpwn
orbit_camera_tilt -= mouse_force.y*3;
player.pan = player.pan%360;
if(orbit_camera_tilt < -45){orbit_camera_tilt = -45;}
if(orbit_camera_tilt > 90){orbit_camera_tilt = 90;}
me = player;
c_trace(cam_centre.x,cam_pos.x, ignore_me + ignore_passable + ignore_models + ignore_sprites); // if trace hits something
if(trace_hit > 0)
{
vec_diff(temp.x, cam_centre.x, target.x); //temp is vector from target to view target
vec_normalize(temp.x, 16); //camera will back off by 16 if its trace hits a wall ect.
vec_set(camera.x,target.x);
vec_add(camera.x,temp.x);
}
else
{
vec_set(camera.x,cam_pos.x ); // camera's target
}
ok..
What I'm aiming for is when your moving your mouse to aim and fire (your in 3rd person) that when the crosshair gets on your character it turns the character transparent so you can still see to aim your weapon correctly.
and yes ... my coding is ugly