This isn’t programmed in Java, so that’s why I put it here. But since it’s math, people here should be able to understand it. I’m trying to make a hitscan script in a 3D space, but it doesn’t work right at all, since it always “detects” that I aim at my feet, and not where I aiming at. So I want to know, if the problem the math, or somewhere else?
lv_x = Sin(lv_pitch) * Cos(lv_yaw);
lv_y = Sin(lv_pitch) * Sin(lv_yaw);
lv_z = Cos(lv_pitch);
lv_x = PointGetX(CameraGetTarget(lp_player)) + (lv_x * lv_distance);
lv_y = PointGetY(CameraGetTarget(lp_player)) + (lv_y * lv_distance);
lv_z = lv_cameraHeight + (lv_z * lv_distance);
lv_distance increases by 1 in a while loop until it hits something.
lv_pitch and lv_law is both in degrees.