Garry's Mod Wiki

Revision Difference

Entity:PhysicsFromMesh#549836

<function name="PhysicsFromMesh" parent="Entity" type="classfunc"> <description> Initializes the physics mesh of the entity from a triangle soup defined by a table of vertices. The resulting mesh is hollow, may contain holes, and always has a volume of 0. While this is very useful for static geometry such as terrain displacements, it is advised to use <page>Entity:PhysicsInitConvex</page> or <page>Entity:PhysicsInitMultiConvex</page> for moving solid objects instead. ⤶ <note>This feature is NOT included in the `x86-x64` branch. It is considered broken since April 2023(on the experimental branches only). However it completely works as intended within distribution branch of Garry's Mod.</note>⤶ <page>Entity:EnableCustomCollisions</page> needs to be called if you want players to collide with the entity correctly. </description> <realm>Shared</realm> <args> <arg name="vertices" type="table">A table consisting of <page>Structures/MeshVertex</page> (only the `pos` element is taken into account). Every 3 vertices define a triangle in the physics mesh.</arg> <arg name="surfaceprop" type="string" added="2023.01.25" default="default">Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with <page>physenv.AddSurfaceData</page>.</arg></arg> </args> <rets> <ret name="" type="boolean">Returns `true` on success, `nil` otherwise.</ret> </rets> </function>