Jump to content

GetEntityMaterial


macklebee
 Share

Recommended Posts

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

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

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!

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

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