Jump to content

model lighting problem.


dennis
 Share

Recommended Posts

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

Link to comment
Share on other sites

look at the inherent 'fixture_cagelight' object script... its doing exactly what you are attempting...

Thanks mack.

very great help, but still not working :D

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

Link to comment
Share on other sites

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...

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

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 :D but the effect is not really wanted. the light is just like a supernova. really powerful.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...