Garry's Mod

Garry's Mod

SGM's Vehicle Model Attaching Framework
 Toto téma bylo přilepeno, takže je nejspíš důležité
SGM ツ  [vývojář] 23. říj. 2022 v 12.58
How to use
For vehicle developers
Add the following code at the bottom of the lua file for your vehicle:
SGM = SGM or {} SGM.AttachModels = SGM.AttachModels or {} SGM.AttachModelsByClass = SGM.AttachModelsByClass or {} SGM.AttachedModels = SGM.AttachedModels or {} SGM.AttachModels["models/my/car.mdl"] = { { Model = "models/my/car_model2.mdl", Pos = Vector(0,0,0), Ang = Angle(0,0,0), Color = Color(255,255,255), Scale = 1, -- BodyGroups = { -- {1,1}, -- {2,1}, -- }, BoneMerge = true, --bone merging, pretty self-explanatory BoneParent = "", --bone parenting, this makes the prop follow a specific bone RenderMode = RENDERMODE_NORMAL, --render mode just in case you need it, although you usually shouldn't Sync = true, --sync colors,materials, and bodygroups between the two models SyncSubMaterials = true, --sync submaterials between the models -- SyncFunction = function(car, prop) -- if !IsValid(car) or !IsValid(prop) then return end --if you really know what you're doing you can add custom functions for interactions between the vehicle and the prop, these get called each sync (default: every 2 seconds) -- end, -- SubMaterials = { -- [0] = "sentry/shared/skin0", --ability to change the submaterials of the prop if necessary -- }, }, }
All of these properties are optional, for optimization, make sure to disable syncing functions if you don't need them.

For Photon "developers"
Add the following code at the bottom of the lua file for your vehicle:
SGM = SGM or {} SGM.AttachModels = SGM.AttachModels or {} SGM.AttachModelsByClass = SGM.AttachModelsByClass or {} SGM.AttachedModels = SGM.AttachedModels or {} SGM.AttachModelsByClass["class_name_of_my_photon_car"] = { { Model = "models/tadano/fumo/pack/cirno.mdl", Pos = Vector(0,0,0), Ang = Angle(0,0,0), Color = Color(255,255,255), Scale = 1, -- BodyGroups = { -- {1,1}, -- {2,1}, -- }, BoneMerge = false, --bone merging, pretty self-explanatory BoneParent = "", --bone parenting, this makes the prop follow a specific bone RenderMode = RENDERMODE_NORMAL, --render mode just in case you need it, although you usually shouldn't Sync = false, --sync colors,materials, and bodygroups between the two models SyncSubMaterials = false, --sync submaterials between the models -- SyncFunction = function(car, prop) -- if !IsValid(car) or !IsValid(prop) then return end --if you really know what you're doing you can add custom functions for interactions between the vehicle and the prop, these get called each sync (default: every 2 seconds) -- end, -- SubMaterials = { -- [0] = "sentry/shared/skin0", --ability to change the submaterials of the prop if necessary -- }, }, }

Example of adding two models to the same car
You can add as many models as you want, as long as you add them properly.
SGM = SGM or {} SGM.AttachModels = SGM.AttachModels or {} SGM.AttachModelsByClass = SGM.AttachModelsByClass or {} SGM.AttachedModels = SGM.AttachedModels or {} SGM.AttachModels["models/my/car.mdl"] = { { Model = "models/my/car_model2.mdl", Pos = Vector(0,0,0), Ang = Angle(0,0,0), Color = Color(255,255,255), Scale = 1, -- BodyGroups = { -- {1,1}, -- {2,1}, -- }, BoneMerge = true, --bone merging, pretty self-explanatory BoneParent = "", --bone parenting, this makes the prop follow a specific bone RenderMode = RENDERMODE_NORMAL, --render mode just in case you need it, although you usually shouldn't Sync = true, --sync colors,materials, and bodygroups between the two models SyncSubMaterials = true, --sync submaterials between the models -- SyncFunction = function(car, prop) -- if !IsValid(car) or !IsValid(prop) then return end --if you really know what you're doing you can add custom functions for interactions between the vehicle and the prop, these get called each sync (default: every 2 seconds) -- end, -- SubMaterials = { -- [0] = "sentry/shared/skin0", --ability to change the submaterials of the prop if necessary -- }, }, { Model = "models/my/car_model3.mdl", Pos = Vector(0,0,0), Ang = Angle(0,0,0), Color = Color(255,255,255), Scale = 1, -- BodyGroups = { -- {1,1}, -- {2,1}, -- }, BoneMerge = true, --bone merging, pretty self-explanatory BoneParent = "", --bone parenting, this makes the prop follow a specific bone RenderMode = RENDERMODE_NORMAL, --render mode just in case you need it, although you usually shouldn't Sync = true, --sync colors,materials, and bodygroups between the two models SyncSubMaterials = true, --sync submaterials between the models -- SyncFunction = function(car, prop) -- if !IsValid(car) or !IsValid(prop) then return end --if you really know what you're doing you can add custom functions for interactions between the vehicle and the prop, these get called each sync (default: every 2 seconds) -- end, -- SubMaterials = { -- [0] = "sentry/shared/skin0", --ability to change the submaterials of the prop if necessary -- }, }, }
Naposledy upravil SGM ツ; 25. říj. 2022 v 12.24
< >
Zobrazuje se 110 z 10 komentářů
W4nou 25. říj. 2022 v 10.24 
is there already a way to change the body groups of the added model? if not, is it planned for a future update?
SGM ツ  [vývojář] 25. říj. 2022 v 11.17 
W4nou původně napsal:
is there already a way to change the body groups of the added model? if not, is it planned for a future update?
it's possible to add, but the original idea was that as a vehicle developer you'd only want to either sync bodygroups between two models if they match, or not change bodygroups at all because you would have already set up the model how you wanted it. it can be added though
W4nou 25. říj. 2022 v 11.29 
it's not for a vehicle it's only for a skin without emergency lights and i would have like to add models to it
Naposledy upravil W4nou; 25. říj. 2022 v 11.35
SGM ツ  [vývojář] 25. říj. 2022 v 12.25 
W4nou původně napsal:
it's not for a vehicle it's only for a skin without emergency lights and i would have like to add models to it
added, make sure to disable syncing otherwise the vehicles bodygroups will take priority
W4nou 25. říj. 2022 v 13.11 
amazing, thank you
sol 28. říj. 2022 v 6.21 
sgm can i pm u in any way i need help with my vcmod purchase, i tried reaching out to free and he didnt respond
I hate SGM. Just waste of internet for bloatware and more lag.
porkicurtu původně napsal:
I hate SGM. Just waste of internet for bloatware and more lag.
yeah ur mother told me how much she hated you last night when i got done with her, Told her we should of aborted
its no working
Is simfphys supported?
< >
Zobrazuje se 110 z 10 komentářů
Na stránku: 1530 50