Original Post
Hey, I have seen a lot of topics related to bullet tracing, trajectories of projectiles and more, But its all a bit complex for what am looking for is considered "simple", Am looking for a way to get a bullet to proceed forward from the current client origin, No forces affect the bullet path, The bullet isn`t even based on time factor (yet), the bullet should proceed forward by a constant number with each passing frame. This is my code so far, only the forward direction, its nice that i have the direction, but how do i keep the bullet going into that direction, from the current player position?
void ACTIVE_WEAPON::GET_BULLET_TRACE()
{
VECTOR_3D<float>SAMPLE(0,0,0); // A simple 3D space vector contains
// X, y, z
float R = sqrt(pow(PTR_CAMERA->ROTATED.m_y, 2) + pow(PTR_CAMERA->ROTATED.m_x, 2)); // Normalization
SAMPLE.m_x = M_WEAPON_ANGLE.m_x = (-PTR_CAMERA->ROTATED.m_y / R);
// X forward
SAMPLE.m_y = M_WEAPON_ANGLE.m_y = (PTR_CAMERA->ROTATED.m_x / R);
// Y forward
SAMPLE.m_z = 0;
M_BULLET_TRACE = SAMPLE; // Convert temp SAMPLE vector into M_BULLET_TRACE which is also a vector.
M_BULLET_ALIVE = true; // Should be set to false when collided, as long
// As its toggled to true, keep the bullet updated to proceed forward
};
void ACTIVE_WEAPON::UPDATE_BULLET()
{
// I tried few things here, some equations related to position calculation, but not much luck
return;
};