Garry's Mod

Garry's Mod

SGM's Vehicle Model Attaching Framework
 Denne tråd er blevet fastgjort, så den er sikkert vigtig
SGM ツ  [udvikler] 23. okt. 2022 kl. 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 -- }, }, }
Sidst redigeret af SGM ツ; 25. okt. 2022 kl. 12:24
< >
Viser 1-10 af 10 kommentarer
W4nou 25. okt. 2022 kl. 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 ツ  [udvikler] 25. okt. 2022 kl. 11:17 
Oprindeligt skrevet af W4nou:
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. okt. 2022 kl. 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
Sidst redigeret af W4nou; 25. okt. 2022 kl. 11:35
SGM ツ  [udvikler] 25. okt. 2022 kl. 12:25 
Oprindeligt skrevet af W4nou:
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. okt. 2022 kl. 13:11 
amazing, thank you
sol 28. okt. 2022 kl. 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
76561199444131364 18. jan. 2023 kl. 10:48 
2
I hate SGM. Just waste of internet for bloatware and more lag.
Sanya 18. jan. 2023 kl. 10:57 
Oprindeligt skrevet af porkicurtu:
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
SMG4 Fan 25. juli 2023 kl. 16:16 
its no working
_Doctor_Gunner_ 23. okt. 2023 kl. 0:06 
Is simfphys supported?
< >
Viser 1-10 af 10 kommentarer
Per side: 1530 50