drawSpotLight
DRAW_SPOT_LIGHT0xD0F64B265C8C8B33The GTA V native DRAW_SPOT_LIGHT of the GRAPHICS namespace, as LS:MP client scripts call it: the global function drawSpotLight, in JavaScript and in Lua.
drawSpotLight(
posX: number,
posY: number,
posZ: number,
dirX: number,
dirY: number,
dirZ: number,
colorR: number,
colorG: number,
colorB: number,
distance: number,
brightness: number,
hardness: number,
radius: number,
falloff: number
): voiddrawSpotLight(
posX: number,
posY: number,
posZ: number,
dirX: number,
dirY: number,
dirZ: number,
colorR: integer,
colorG: integer,
colorB: integer,
distance: number,
brightness: number,
hardness: number,
radius: number,
falloff: number
)Usage
drawSpotLight(
posX, posY, posZ, dirX, dirY, dirZ, colorR, colorG, colorB, distance, brightness, hardness,
radius, falloff
);drawSpotLight(
posX, posY, posZ, dirX, dirY, dirZ, colorR, colorG, colorB, distance, brightness, hardness,
radius, falloff
)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
drawSpotLight(
pos, dir, colorR, colorG, colorB, distance, brightness, hardness, radius, falloff
);drawSpotLight(pos, dir, colorR, colorG, colorB, distance, brightness, hardness, radius, falloff)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
posX | float | number | number |
posY | float | number | number |
posZ | float | number | number |
dirX | float | number | number |
dirY | float | number | number |
dirZ | float | number | number |
colorR | int | number | integer |
colorG | int | number | integer |
colorB | int | number | integer |
distance | float | number | number |
brightness | float | number | number |
hardness | float | number | number |
radius | float | number | number |
falloff | float | number | number |
Returns
Nothing. In JavaScript the call evaluates to undefined.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Parameters:
* pos - coordinate where the spotlight is located
* dir - the direction vector the spotlight should aim at from its current position
* r,g,b - color of the spotlight
* distance - the maximum distance the light can reach
* brightness - the brightness of the light
* roundness - "smoothness" of the circle edge
* radius - the radius size of the spotlight
* falloff - the falloff size of the light's edge
Example in C# (spotlight aims at the closest vehicle):
Vector3 myPos = Game.Player.Character.Position;
Vehicle nearest = World.GetClosestVehicle(myPos , 1000f);
Vector3 destinationCoords = nearest.Position;
Vector3 dirVector = destinationCoords - myPos;
dirVector.Normalize();
Function.Call(Hash.DRAW_SPOT_LIGHT, pos.X, pos.Y, pos.Z, dirVector.X, dirVector.Y, dirVector.Z, 255, 255, 255, 100.0f, 1f, 0.0f, 13.0f, 1f);Reference
- Namespace
- Graphics GRAPHICS
- In the game
void DRAW_SPOT_LIGHT(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, int colorR, int colorG, int colorB, float distance, float brightness, float hardness, float radius, float falloff)- Hash
0xD0F64B265C8C8B33