macklebee Posted March 1, 2010 Share Posted March 1, 2010 Why does Script1 work but Script2 does not? It appears that the GetEntityMaterial command only works on items where the material is already Loaded/Painted by code. Or am I just leaving something out, that would allow me to access the material from a loaded entity? Script1: RegisterAbstractPath("") Graphics(1024,768) fw=CreateFramework() SetGlobalObject("framewerk",fw) camera=fw.main.camera camera:SetPositionf(0,0,-2) light=CreateSpotLight(10) light:SetRotationf(45,55,0) light:SetPositionf(5,5,-5) material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() mesh:Paint(material) ground=CreateCube() ground:SetScalef(10.0,1.0,10.0) ground:SetPositionf(0.0,-2.0,0.0) ground:Paint(mesh.material) light=CreateDirectionalLight() light:SetRotationf(45,45,45) while AppTerminate()==0 do mesh:Turnf(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5) fw:Update() fw:Render() Flip(0) end Script2: RegisterAbstractPath("") Graphics(1024,768) fw=CreateFramework() SetGlobalObject("framewerk",fw) camera=fw.main.camera camera:SetPositionf(0,0,-2) light=CreateSpotLight(10) light:SetRotationf(45,55,0) light:SetPositionf(5,5,-5) mesh=LoadMesh("abstract::oildrum.gmf") ground=CreateCube() ground:SetScalef(10.0,1.0,10.0) ground:SetPositionf(0.0,-2.0,0.0) ground:Paint(mesh.material) light=CreateDirectionalLight() light:SetRotationf(45,45,45) while AppTerminate()==0 do mesh:Turnf(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5) fw:Update() fw:Render() Flip(0) end 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...
Rick Posted March 1, 2010 Share Posted March 1, 2010 I see you are using the property mesh.material. Did you try the functions instead of the properties? GetMaterial() or even GetEntityMaterial() to see if those work? Quote Link to comment Share on other sites More sharing options...
macklebee Posted March 1, 2010 Author Share Posted March 1, 2010 yes I had already tried GetEntityMaterial... and GetMaterial is not a function recognized by lua. You are thinking of the GetMaterial() from c++ which is actually GetSurfaceMaterial(). 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...
macklebee Posted March 1, 2010 Author Share Posted March 1, 2010 hmmm but this will work... convoluted but it works: RegisterAbstractPath("") Graphics(1024,768) fw=CreateFramework() SetGlobalObject("framewerk",fw) camera=fw.main.camera camera:SetPositionf(0,0,-2) light=CreateSpotLight(10) light:SetRotationf(45,55,0) light:SetPositionf(5,5,-5) mesh=LoadMesh("abstract::oildrum.gmf") ground=CreateCube() ground:SetScalef(10.0,1.0,10.0) ground:SetPositionf(0.0,-2.0,0.0) ground:Paint(GetSurfaceMaterial(GetSurface(mesh,1))) light=CreateDirectionalLight() light:SetRotationf(45,45,45) while AppTerminate()==0 do mesh:Turnf(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5) fw:Update() fw:Render() Flip(0) end interesting... thanks for the nudge in the right direction! 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.