Brutile Posted January 30, 2017 Share Posted January 30, 2017 I'm trying to get the material of a raycast entity, but It won't let me get the material of a CSG as I'm pretty sure the geometry gets combined for optimization. Is there a way to get the material from a CSG? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 30, 2017 Share Posted January 30, 2017 make sure the csg is not collapsed by setting an empty script to the mesh. Quote Link to comment Share on other sites More sharing options...
Brutile Posted January 30, 2017 Author Share Posted January 30, 2017 That works, thanks. Its not ideal, but there's probably no other way. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 30, 2017 Share Posted January 30, 2017 I agree it is a 'hacky' method. This has been around for years unfortunately. It has been opted several times to include some sort of checkbox in the appearance tab or something which would be far more logical than setting a mass or attaching an emtpy script. Quote Link to comment Share on other sites More sharing options...
Genebris Posted January 30, 2017 Share Posted January 30, 2017 I'm gettings a material from csg without script or mass. Do you get the surface? tolua.cast(pickinfo.entity, "Model"):GetSurface(0):GetMaterial() 1 Quote Link to comment Share on other sites More sharing options...
shadmar Posted January 30, 2017 Share Posted January 30, 2017 Checkout GetFace() http://www.leadwerks.com/werkspace/topic/14455-getting-brushes-surface/page__hl__getface#entry98872 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Brutile Posted January 31, 2017 Author Share Posted January 31, 2017 @shadmar That looks like it'll do the trick! @Genebris That would work in most cases, but if the surface has more than one surface, it won't work. Thanks everyone! Edit: My final solution is to get the face from the Pick, then get the material from the face, just in case anyone is reading this in the future with the same question. More info here http://www.leadwerks.com/werkspace/page/api-reference/_/pickinfo/ 1 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.