Jump to content

Adjust texture mapping in code


Rick
 Share

Recommended Posts

I'm using CopyEntity() for a cube. I want to paint different mats on this cube but since I'm using CopyEntity() it creates an instance so painting a mat on one does it for all. My needs with this are very basic. My texture would just be white, blue, or red. Ideally I would be able to make a 512x512 where I have 4 256x256 inside of it where each section is a color. Then I always paint the same material on the cubes, but just adjust the texture mappings on the ones I want to show different colors. I know that one nio guy created something like this but for shader. I wonder how would one go about doing this in LE code instead? Shader isn't an option as I don't want other people to have to modify their shader.pak file if they use this Thingoid.

 

Any code or point me in the right direction would be great. Thanks!

Link to comment
Share on other sites

@ macklebee, good point. Guess I was thinking it had to be in the pak file but I guess it makes sense it doesn't have to be if everything just uses the abstract idea.

 

@Josh, I was trying EntityColor() on these but no matter what I used for Vec4() parameter it was turning the cube black.

EntityColor(pick.entity, Vec4(1, 0, 0, 1) would result in a black cube. So just figured it doesn't work since on the wiki under that command it mentions something about not working on Meshs.

Link to comment
Share on other sites

for lua:

entity:SetColor( color:TVec4, recursive )

 

granted EntityColor() should still work but it doesn't for whatever reason...

 

and while it does say that it doesn't work on meshes in the command description in the wiki... the very same page also says "This will only have an effect on meshes, lights, emitters and coronas.", which of course it does... as can be seen in a multitude of examples here in this forum. The best bet is to use the Entities page that was created after lua was introduced into LE.

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