Jump to content
SpEcIeS

Cylinder and Materials

Recommended Posts

Created a script this morning to load a cylinder with an attached script, however the material does not seem to load for the cylinder, or a cone, shaped CSG. Spheres and boxes load without issue. Not really sure why the materials are not loading, but I am hoping someone could clear this up.

 

function Script:Use(entity)
  local bottle = Model:Cylinder()
  local material = Material:Load("Materials/Developer/bluegrid.mat")

  bottle:SetMaterial(material)
  bottle:SetScale(0.15,0.65,0.15)
  bottle:SetPosition(-4.4,1.6,1.9)

  local shape = Shape:Cylinder()
  bottle:SetShape(shape)
  bottle:SetMass(1)

  bottle:SetScript("Scripts/Functions/PickupHealth.lua")
end

Share this post


Link to post

Not sure, but I would assume, the material gets overwritten by the SetShape-function. Have you tried putting the SetMaterial after that?

Share this post


Link to post

Yes, unfortunately it does not change anything. If you try out the code, but change "Model:Cylinder" to "Model:Box", or "Model:Sphere", the material loads as expected. If Cylinder, or Cone is applied to Load, the material does not get used.

Share this post


Link to post

Yes, appears to be a bug - like the UV's are not being set properly upon creation of the cylinder or cone when done via code. This has nothing to do with adding a physics shape.I would suggest you open a bug report with a simple main.lua script that shows the issue instead of an object script.

Share this post


Link to post

Can someone confirm this is solved please ? I cannot find a bug report. Thanks

 

I have a similar problem in C++ with a box. Texture orangegrid.mat doesnt show.

 

PS: I'm not using beta version

Share this post


Link to post

Box and sphere in lua appear to work fine - cylinder and cone do not.

Thanks for the info. In C++ I cannot bring it to work with a box too. Engine log says material texture loads ok, but for some reason does not apply to the model (and no error message). Trying to figure out if it could be my fault, but running out of ideas yet (Just doing Model->Model::Setmaterial(Material, false); Tryed with Entity::Setmaterial or without Model::, same result).

 

EDIT: hummm ... in fact there is a bug report here http://www.leadwerks.com/werkspace/topic/14362-cylinder-and-cones-not-loading-materials/

I must still do something wrong, it doesn't make sense the bug is not exactly the same between lua and C++, since lua is propably using the c++ lib.

Share this post


Link to post

Please provide a code example that demonstrates boxes not being created with texture coordinates. I don't think this happens.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...