Retrieving the number of faces/triangles in a prop/model?

Just curious - is it possible to retrieve the number of faces or triangles in a prop/model?


I cannot answer your question, but…
Do not sign your posts. Trust me.
Stick around and you’ll eventually see why.

There is no binding for that.

The only way I think it can be done, is by reading the binary model file. ( I am not even sure if you can open them with file.Read )

Soo… I would say impossible, without a binary module, or very mutch work.

[lua]function _R.Entity:GetTriangleCount()

return #ent:GetPhysicsObject():GetMesh() / 3


Technically this is the number of triangles in the models physics representation, not the model itself, but I reckon it’s as close as you’re gonna get.

[editline]7th September 2012[/editline]

Oh and it’ll only work in GMod 13

Well that kinda sucks.

I was just curious to see if it were possible at all to create a better prop limiting system, where you have a triangle budget rather than the number props. Because, seriously, 30 1x1 plates aren’t going to lag anyone up, but 30 bathtubs? That is definitely gonna cause more slowdown.

Then this is perfect for you, I think the physics are the main reason behind prop lag

That’s not helping. No need to be a dick about someone not following the “formality of facepunch”

Unlike other “dicks”, I do not see the fun in seeing people banned.

They wouldn’t be banned for that?

Not on one incident, at least.
I remember seeing people banned for this.
I’m just trying to help.

You said it with an E-Attitude

Not really, he was just giving advice.

I just wish people would PM the person that, it’s just considered rude by my standards.

What’s rude? Pointing something out publicly?

Basically saying that facepunch is the ~strictest place in the world~