SetLightIntensity

From MaratisWiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Modify the light intensity. Example 1 : With the help of a timer, the light intensity will increase & decrease over time. Light0 = getObject("Light0") t = 0 --...")
 
m
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
Modify the light intensity.
+
{{lua-function|setLightIntensity|object, intensity}}
  
Example 1 : With the help of a timer, the light intensity will increase & decrease over time.
+
Set the light intensity.
 +
 
 +
{{lua-function-param|object|object to operate on}}
 +
{{lua-function-param|intensity|light intensity}}
 +
 
 +
'''Example 1:''' With the help of a timer, the light intensity will increase & decrease over time.
  
 
     Light0 = getObject("Light0")  
 
     Light0 = getObject("Light0")  
Line 14: Line 19:
 
         print(t)
 
         print(t)
 
     end
 
     end
 +
 +
[[Category:Lua scripting]]
 +
[[Category:Lua function]]
 +
[[Category:Light]]

Latest revision as of 01:30, 9 February 2014

setLightIntensity(object, intensity)

Set the light intensity.

  • object : object to operate on
  • intensity : light intensity

Example 1: With the help of a timer, the light intensity will increase & decrease over time.

   Light0 = getObject("Light0") 
   t = 0	
   -- Scene update
   function onSceneUpdate()
       flash = getLightIntensity(Light0)
       t = t + 1
       if t < 50 then setLightIntensity(Light0, flash+0.02) end
       if t > 50 then setLightIntensity(Light0, flash-0.02) end
       if t == 100 then t = 0 end
       print(t)
   end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox