wh1sp3r Posted February 25, 2010 Share Posted February 25, 2010 I have problem to set a color to my directional light local light = class:GetLight() -- this function returns first direction light handle light:SetColor( Vec4(1.0/255.0, 0.0/255.0, 0.0/255.0 ,1.0) ) light handle is OK, because i can rotate light but i can'T set color. thank you Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
Niosop Posted February 25, 2010 Share Posted February 25, 2010 That code sets it to almost black. Is that what you wanted? Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 25, 2010 Author Share Posted February 25, 2010 ... ok, wrong math, lol but still .. color of light is not changing for example : light:SetColor( Vec4(0, 1, 0 ,1.0) ) for green light and nothing Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 looks like you are trying to set the color for the light class and not the light model. Need to see your complete code to be able to tell for sure whats going on... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 25, 2010 Author Share Posted February 25, 2010 function class:GetLight() class = classnametable[ "light_directional" ] if class~=nil then for model,object in pairs(class.instances) do return model end end end Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 hmmm this seems to work fine for me... require("scripts/class") local class=CreateClass(...) function class:GetLight() class = classnametable[ "light_directional" ] if class~=nil then for model,object in pairs(class.instances) do return model end end end function class:CreateObject(model) local object=self.super:CreateObject(model) local light=class:GetLight() light:SetColor(Vec4(0,1,0,1), 1) end when I place the entity that has this script into the scene it instantly changes the directional light's color... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 25, 2010 Author Share Posted February 25, 2010 yes, me too ... reason ? your code light:SetColor(Vec4(0,1,0,1), 1) my code light:SetColor(Vec4(0, 1, 0 ,1.0) ) what is a second parameter ? Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 its the recursive parameter to EntityColor Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.