I noticed a bit ago in a video on SRB 3.0 they have a mod that draws a spot light from your player in the direction you're facing. It's pretty damn cool But also simple af so i thought i'd re-make and post here for others who may not have figured out how to do it OR didn't know about it. Picture -https://cdn.discordapp.com/attachments/519624715904745474/568435788283510784/image0.jpg
Code:
void GET_CAMERA_DIRECTION(float *dirX, float *dirY, float *dirZ) {
float tX, tZ, num;
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(0);
tZ = rot.z * 0.0174532924f;
tX = rot.x * 0.0174532924f;
num = abs(cos(tX));
*dirX = (-sin(tZ)) * num;
*dirY = (cos(tZ)) * num;
*dirZ = sin(tX);
}
if (Draw_Spotlight) {
float x, y, z;
GET_CAMERA_DIRECTION(&x, &y, &z);
Vector3 Cords = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
GRAPHICS::DRAW_SPOT_LIGHT(Cords.x, Cords.y, Cords.z + 0.5f, x, y, z, Light_R, Light_G, Light_B, Light_Distance, Light_Brightness, Light_Roundness, Light_Radius, Light_FallOff);
}
int Light_R = 0, Light_G = 130, Light_B = 0;
float Light_Distance = 0, Light_Brightness = 0, Light_Roundness = 0, Light_Radius = 0, Light_FallOff = 0;