Jump to content

Light Lib (1.5)


Recommended Posts

Hello everyone, today i decided to give a try to the 1.5 new "Light" functions, and they are somewhat odd.

I've found out they affect only the ped?

Is this a bug or just how it is going to be?

Code used:

  
  
local light = createLight(1, 0,0,0,12,255,0,255,0,0,2,true) 
  
addEventHandler('onClientPreRender',root,function() 
local veh = getPedOccupiedVehicle(localPlayer) 
local rad = getElementRadius(veh) 
setLightRadius(light, rad*2) 
local x,y,z = getElementPosition(veh) 
local dist = getElementDistanceFromCentreOfMassToBaseOfModel ( veh ) 
setElementPosition(light, x,y,z-dist) 
  
end) 
  

Result:

EDIT: Tried making it from up...

  
  
local light = createLight(1, 0,0,0,12,255,0,255,0,0,-2,true) 
  
addEventHandler('onClientPreRender',root,function() 
local veh = getPedOccupiedVehicle(localPlayer) 
local rad = getElementRadius(veh) 
setLightRadius(light, rad*2) 
local x,y,z = getElementPosition(veh) 
local dist = getElementDistanceFromCentreOfMassToBaseOfModel ( veh ) 
setElementPosition(light, x,y,z+dist*4) 
  
end) 
  

Result:

EDIT2: Adding more lights to "apply the multiplier to everything" only seems to affect elements, but not the "world"

  
  
local light = createLight(1, 0,0,0,12,255,0,255,0,0,-2,true) 
local light2 = createLight(1, 0,0,0,12,255,0,255,0,0,-2,true) 
local light3 = createLight(1, 0,0,0,12,255,0,255,0,0,-2,true) 
  
addEventHandler('onClientPreRender',root,function() 
local veh = getPedOccupiedVehicle(localPlayer) 
local rad = getElementRadius(veh) 
setLightRadius(light, rad*2) 
local x,y,z = getElementPosition(veh) 
local dist = getElementDistanceFromCentreOfMassToBaseOfModel ( veh ) 
setElementPosition(light, x+2,y,z+dist*4) 
setElementPosition(light2, x+2,y,z+dist*4) 
setElementPosition(light3, x+2,y,z+dist*4) 
end) 
  

created objects are not affected aswell

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...