dennis Posted March 7, 2012 Share Posted March 7, 2012 Hello all, I written a small LUA script. but it isn't working yet. can someone tell me whats wrong? require("scripts/class") require("scripts/constants/collision_const") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.model:SetKey("collisiontype", COLLISION_SCENE) end light1 = CreatePointLight(10) light1:SetColor(Vec4(255, 233, 172, 255)) light1:SetShadowmapSize(512) EntityColor(light1, Vec4(0.56)) light1:SetPosition(Vec3(-0.72,10.05,26.95)) I was thinking, to make it a function so I could load all it's parameters inside the game when loading the scene like: function modellighting() light1 = CreatePointLight(10) light1:SetColor(Vec4(255, 233, 172, 255)) light1:SetShadowmapSize(512) EntityColor(light1, Vec4(0.56)) light1:SetPosition(Vec3(-0.72,10.05,26.95)) end any other possibility's ? Like to hear them, the reason I chose to let the model creates light itself. is because it will costs less time to generate all physics but just only loading the model. cheers Quote Link to comment Share on other sites More sharing options...
macklebee Posted March 7, 2012 Share Posted March 7, 2012 look at the inherent 'fixture_cagelight' object script... its doing exactly what you are attempting... 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...
dennis Posted March 7, 2012 Author Share Posted March 7, 2012 look at the inherent 'fixture_cagelight' object script... its doing exactly what you are attempting... Thanks mack. very great help, but still not working now I used:: require("scripts/class") require("scripts/constants/collision_const") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.model:SetKey("collisiontype", COLLISION_SCENE) function object:Init() self.light1=CreatePointLight(10) self.light1:SetColor(Vec4(255, 233, 172, 255)) self.light1:SetPosition(Vec3(-0.72,10.05,26.95)) self.light1:SetShadowOffset(0,0.93,0) self.light1:SetShadowmapSize(512) self.light1:EntityColor(light1, Vec4(0.56)) self.model:SetShadowMode(0,1) self.light1:SetShadowMode(7) end end Quote Link to comment Share on other sites More sharing options...
macklebee Posted March 7, 2012 Share Posted March 7, 2012 why not just copy over the entire script and save it for your model's script... then use the properties dialog to pick your settings... thats what its there for... but in any case, your script above isnt working because you are not calling the object:Init() function... add it after that function just like in the fixture_cagelight script... 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...
dennis Posted March 7, 2012 Author Share Posted March 7, 2012 the reason because I won't copy over the whole script is just because there are more than one light. and in the cagelight script there's just place for a single light. I want to make a more hybrid script for my own, just for practicing it worked but the effect is not really wanted. the light is just like a supernova. really powerful. Quote 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.