Getting the verticies from a brush

I was wondering if it was possible to get the actual points of a brush entity in order to build a mesh from it.
My end goal was to materialize an invisible brush so it would be visible, but I don’t believe this is possible so another possibility would be to make a copy of the brush using a mesh. I know other people have done it, I just know know exactly how they did it and I can’t find any useful information on the subject.

The only way to get the vertices of a brush is to parse the BSP data and extract the needed information.

SilverLan made some stuff that did that under the title: ‘Wrench’. It’s on the workshop if you want to look at how he accomplished that.

Sounds like it would just be simpler to do it once and store it in a .txt file in /data/ for further use rather than doing it in-game on runtime.

PhysObj:GetMeshConvexes() works on the world too, you dont have to parse the bsp yourself

Once you’ve figured out how to do it there is no point in saving it to a file instead of generating it, so long as it is a quick process.

Anyone know how long it takes?

] lua t = SysTime() this:GetPhysicsObject():GetMeshConvexes() print( SysTime() - t )

That was on the assumption that I would have to decompile the BSP files and use a VMF parsing method, with a simple solution like posted above it should be pretty easy. It’s just not something I’ve done before, they’res always something you don’t know about a convoluted and poorly documented language :smiley: (not Lua but the Gmod part)

That returns the physics mesh, not the visual one

[editline]11th September 2013[/editline]

Nevermind I misread, thought OP wanted to do it on models (hard to read shit on my phone)

Which is all I care about, so this is solved…
Also brushes can have a visible mesh that isn’t their physics mesh?