Garry's Mod

Garry's Mod

34 ratings
[E2] Mesh Core
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: ServerContent
Addon Tags: Build
File Size
Posted
Updated
6.137 KB
31 Jan, 2015 @ 8:33am
26 Mar, 2017 @ 8:16am
19 Change Notes ( view )

Subscribe to download
[E2] Mesh Core

Description
THIS IS AN EXTENSION FOR WIREMOD, NOT CONSOLE COMMANDS
Summary:
This extension allows you to create 'models' in game using the OBJ format.

Example use:
All you do is create the mesh with meshCreate(id, url)
meshCreate(1, "http://my.coolwebsite.com/supercube.obj") meshSetPos(1, entity():pos()) meshSetAng(1, entity():angles()) meshParent(1, entity())
This loads an obj file located at http://my.coolwebsite.com/supercube.obj.

Note:
MTL Files can now be referenced from the OBJ file (see the 'mtllib' line), it will attempt to fetch the file with that name WITH THE SAME URL AS THE OBJ.
For example, you have a OBJ file like 'http://my.website.com/cube.obj'.
In this file you may have
<...> mtllib mycubematerials.mtl <...>
The parser will then attempt to fetch 'http://my.website.com/mycubematerials.mtl'

Functions:

meshCreate(id, string url)
Creates the mesh, similar to holoCreate()

meshSetScale(id, vector scale)
Sets the scale of the mesh.

meshSetPos(id, vector pos)
Moves the origin of the mesh(0,0,0) to <pos>

meshSetAng(id, angle ang)
Sets the mesh rotation to <ang>

meshParent(id, entity parent)
Parents the mesh to the entity <parent>

meshSetURL(id, string url)
Loads an OBJ file from a website.

meshSetMaterial(string material)
Sets the material of the mesh to <material>, can either be a material or a URL

meshSetExtraMTL(id, string url)
Sets an extra MTL file to load additional materials from. <Not Required if 'mtllib' is used in the OBJ>


Commands:

meshcore_canuse 1-2:
Who can use the functions. 1:everyone, 2:only admins. default:1

meshcore_cooldown [sec]:
Time between meshLoadURL's. time in seconds. default:10.

meshcore_maxmesh [num]:
Maximum number of meshes per E2. default:10.

=Clientside=

meshcore_cache_cleartextures:
Clears cached materials so that they are (hopefully) re-rendered when they are requested.

meshcore_cache_clearmeshes
Clears cached meshes. This will force the parser(s) to re-read the files, even if they were not modified.
This should only be used if you updated the MTL file and not the OBJ as the mesh cache works with the OBJ file contents.
21 Comments
Jacbo 15 Jun, 2020 @ 4:06pm 
It doesn't work. Trying to use it gives this error: Expression 2 (a): addons/ulib/lua/ulib/shared/sh_ucl.lua:42: attempt to index local 'ply' (a nil value)
raizenxd 1 May, 2020 @ 3:17am 
Cant add this to my collection
LUIGI 26 Jan, 2019 @ 7:20am 
can you add a way for players to toggle on/off the models. so if it is making them lag thay can turn it off.
[C17] Red Fox 6 Nov, 2018 @ 9:01am 
Will there ever be a fix / additions to this addon again? :(
Shasoleosh Boshasart 16 Sep, 2018 @ 7:53am 
[C17] Red Fox 20 Mar, 2018 @ 10:13pm 
I have seen that theres no command/var to set the mesh color (rgb), the only way currently is to use a texture, which is what im not aiming for, is it possible to add such feature? I think it would be really nice to have it for many reasons. If you dont get what I mean, think about holoColor(number index,vector color). Thanks in advance.
Thomasims  [author] 4 May, 2017 @ 1:43pm 
I'm aware of this bug, it'll be fixed in the next update.
I'll upload it once I'm done with the new features.
Chessi 28 Apr, 2017 @ 1:43am 
Strange bug that I've noticed, it seems to be making a small little can with the milkcrate texture even though the model works.
@name Eagle's Holo Car Modeler (E2 Mesh Core)
@inputs A
@persist E:entity Offset:vector AngOffset:angle Material:string

interval(50)

if(first()|duped()|dupefinished()){
Offset = vec(0,0,0)
AngOffset = ang(0,0,0)
Material = "models/debug/debugwhite"
E = entity():isConstrainedTo()
}
if(changed(E)&E){
meshCreate(1,"some object on my dropbox")
meshSetMaterial(1,Material)
meshSetPos(1,E:toWorld(Offset))
meshSetAng(1,E:toWorld(AngOffset))
meshParent(1,E)}
Thomasims  [author] 23 Mar, 2017 @ 9:27am 
Ok so rewriting is done, new parser logic, etc...
I updated the description and put some info in the changelogs, Please let me know of any issues you encounter!
Thomasims  [author] 14 Feb, 2017 @ 7:30am 
I could add simple mtl support when I get around to rewriting this, I quickly looked at the structure and I think some of it may be implmented.
I don't have much time to work on it currently so in the mean time, the meshSetURLTexture only works on raw images (png/jpg should work)