Hi,
I cant figure out how to adjust my bullet trajectory for hit at the middle of my crosshair whit a 3rd person camera...
i use a bullet code like this one.. anyone can help?
function fire_bullets()
{
VECTOR temp;
proc_kill(4); // don't allow more than 1 copy of this function to run
while (mouse_left) // this loop runs for as long as the left mouse button is pressed
{
vec_for_vertex (temp.x, weapon1, 54); // get the coordinates for the bullets' origin
// create the bullet at camera's position and attach it the "move_bullets" function
ent_create ("bullet.mdl", temp.x, move_bullets);
wait (-0.07); // fire 7 bullets per second (2 * 0.07 * 7 = 1 second)
wait (-0.07);
}
}
function move_bullets()
{
VECTOR bullet_speed; // stores the speed of the bullet
//ang_for_bone(bone1_angle, weapon1, "bone1");
my.skill30 = 1; // I'm a bullet
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);
my.event = remove_bullets; // when it collides with something, its event function (remove_bullets) will run
//my.pan = camera.pan; // the bullet has the same pan
my.pan = camera.pan; // rotate gun by hand angle
my.tilt = camera.tilt; // and tilt with the camera
bullet_speed.x = 100 * time_step; // adjust the speed of the bullet here
bullet_speed.y = 0/*random(0.5)-0.5*/; // the bullet doesn't move sideways
bullet_speed.z = 0/*random(0.5)-0.5*/; // then don't allow the gravity to have its ways with the bullet
while (my) // this loop will run for as long as the bullet exists (it isn't "null")
{
// move the bullet ignoring the passable entities and store the result in distance_covered
c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE);
wait (1);
}
}
I a