Rick Posted February 9, 2014 Share Posted February 9, 2014 http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/asset/ http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/prefab/prefabload-r622 I want each prefab to have their own materials AND to load scripts. I switch materials on prefabs that I shoot and I don't want all the others to have their materials switched. local bomb = Prefab:Load(self.BombPrefab, Asset.Unmanaged or Asset.LoadScripts) 1) How do we do bitwise operations in Lua to get this? 2) What is the constant variable names for both of these? Asset.LoadScripts doesn't seem to work Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 9, 2014 Share Posted February 9, 2014 In real time , i use SetColor() to change the color diffuse of any instanced entity. Should be possible with some sort of SetDiffTexture ? or SetMaterial() ? Didn't dig the docs. Can we change material or shader at run time , in game ? in LE3 ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 9, 2014 Author Share Posted February 9, 2014 I do change the material at run-time to get this effect, but since the models are instances of each other they share a material which means when 1 changes they all change. There is a way when loading models (not prefabs) to make model instances that use their own material, and I need to do this with prefabs. For now I guess I could use SetColor() to shade everything red though, but this would still be nice. [edit] The red shading doesn't look at good because the body is black and you can't see the change. In what I was doing I made another texture that painted the black body red, which is a much better effect. The original question stands. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 10, 2014 Share Posted February 10, 2014 It's Prefab system i think. A prefab is for instancing, so one modification, modifies all instances. Solution : Don't use prefabs , create your own loader with some parameters as shader;color or whatever. I have entities not prefab so change color on one only don't change others. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 10, 2014 Author Share Posted February 10, 2014 I guess I would disagree that a prefab could only be used for instancing. It could easily be used to accomplish this also. Creating my own system is possible, but I'm trying to point things out that would help the engine be better as well. Quote Link to comment Share on other sites More sharing options...
Admin Posted February 10, 2014 Share Posted February 10, 2014 If you just add those two values, it will produce the same result as '|' in C++. The script flag is Map::LoadScripts: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/map/map-r489 1 Quote Link to comment Share on other sites More sharing options...
bandrewk Posted July 11, 2014 Share Posted July 11, 2014 *Bump* Am I doing something wrong or is the unmanaged prefab loading still not working? w_Model = Prefab::Load("Prefabs/Weapons/M4A1/w_M4A1.pfb", Asset::Unmanaged | Map::LoadScripts); Quote 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.