Garry's Mod

Garry's Mod

SGM's Vehicle Model Attaching Framework
 此主題已被置頂,因此它可能很重要
SGM ツ  [開發人員] 2022 年 10 月 23 日 下午 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 -- }, }, }
最後修改者:SGM ツ; 2022 年 10 月 25 日 下午 12:24
< >
目前顯示第 1-10 則留言,共 10
W4nou 2022 年 10 月 25 日 上午 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 ツ  [開發人員] 2022 年 10 月 25 日 上午 11:17 
引用自 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 2022 年 10 月 25 日 上午 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
最後修改者:W4nou; 2022 年 10 月 25 日 上午 11:35
SGM ツ  [開發人員] 2022 年 10 月 25 日 下午 12:25 
引用自 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 2022 年 10 月 25 日 下午 1:11 
amazing, thank you
sol 2022 年 10 月 28 日 上午 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 2023 年 1 月 18 日 上午 10:48 
2
I hate SGM. Just waste of internet for bloatware and more lag.
Sanya 2023 年 1 月 18 日 上午 10:57 
引用自 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 2023 年 7 月 25 日 下午 4:16 
its no working
_Doctor_Gunner_ 2023 年 10 月 23 日 上午 12:06 
Is simfphys supported?
< >
目前顯示第 1-10 則留言,共 10
每頁顯示: 1530 50