SFM to GMod

So, with you guys’ help, I was able to successfully port my model over to SFM.

But I’d also like to know how to port it to Garry’s Mod, so I did a little research and it sounds as simple as adding a phys model to it.

So, I’ve made my own phys model, exported it as SMD, and now I have no idea what to do. I’m not sure how to go about compiling my model (DMX. It already has a VTF and VMT for the single texture it has), and I haven’t been able to find a guide that goes into the QC-making process. I already have a QC, but I’m not sure whether it’d work in Garry’s Mod or not (and I doubt it, since it failed to compile through Crowbar, though this could just be because of something in it that is exclusive to SFM’s requirements or something).

Thanks in advance.

Try to recompile your model, but this time with your reference model and sequence as smd files rather than dmx files as I don’t think GMOD supports dmx files IIRC.

Thanks. I’ll try it.

That doesn’t really explain how I implement my phys model in my QC, though.

GMOD actually supports .DMX files,here are .QC lines what I am using to compile a model for GMOD.


$bodygroup "body"
{
	studio "mesh/flandre_body.dmx"
}

$bodygroup "skirt"
{
	studio "mesh/flandre_skirt.dmx"
}

$bodygroup "face"
{
	blank
	studio "mesh/flandre_face_blue.dmx"
	studio "mesh/flandre_face_black.dmx"
}

$bodygroup "underwear"
{
	studio "mesh/flandre_underwear.dmx"
	blank
}

Well, I’m still kind of stuck here.

Okay, so I’ve made some progress. Firstly, I managed to get it to compile.

But, when I go into HLMV to attempt to add the joint collisions, it’s just coming up as “None” in the Physics tab.

So, I don’t really know what to do, and it’s pretty frustrating!

Here’s my QC:


$modelname "username/mymodel/model.mdl"

$body "model" "model.dmx"

$sequence "idle" model.dmx fps 1

$cdmaterials "models/mymodel/model

$collisionjoints "physmodel.smd"

Anybody? I’m looking for tutorials everywhere but they’re either outdated, for player models, or never ever mention physics models. I really don’t know what to do.

It hasn’t been a day since the last post. You should probably wait longer before bumping.

If it’s just a prop, then you should use $collisionmodel instead of $collisionjoints as that’s used for ragdolls.

An example:


$CollisionModel "physics.smd"
{
	$mass 1
	$inertia 1
	$damping 0
	$rotdamping 0

}

And if it is a ragdoll, then you should use $collisonjoints


$collisionjoints "Phys.smd" {

	$mass 20
	$inertia 1
	$damping 1
	$rotdamping 1
	$rootbone "ExRootBone"
	
	$jointconstrain "Exbone1" x limit -30.00 30.00 0.00
	$jointconstrain "Exbone1" y limit -45.00 45.00 0.00
	$jointconstrain "Exbone1" z limit -75.00 75.00 0.00

	$jointconstrain "Exbone2" x limit -30.00 30.00 0.00
	$jointconstrain "Exbone2" y limit -30.00 30.00 0.00
	$jointconstrain "Exbone2" z limit -30.00 30.00 0.00
}


More info about $collisionmodel and $collisionjoints can be found in the Valve Developer Wiki if you haven’t checked it out already.

Well, I just made a bit of progress, kind of. (Minutes after bumping this, stupidly enough.)

I ticked the “define bones” tab in Crowbar, and that generated a .phy file (which seems to be what I was missing). That has made the bones show up in the physics tab of the HLMV at long last.

Hopefully it’s sorted now. I’ll update if everything goes smoothly.

Yes, the .phy is the physics file SFM does not have. You should be good now

Okay, well that kind of worked.

I can get the model in-game (albeit by searching for it, 'cause for some reason it’s not showing up in addons), but the textures are missing and the legs are super stretchy. I imagine the stretchiness is something I did wrong in the HLMV, which I’m sure I could fix.

But anyone who could shed light on the missing textures and the addons missing would be great. I don’t really know which files are safe to delete after compiling and how to make it into one whole addon, if that makes any sense.

Did you check to see if you put the textures in the right folder? If not, then you should do that. Otherwise if it still showing missing textures, you should check your .smd/.dmx files to see if they are pointing to the correct textures.

Also, the reason why it’s not showing up in the addons section is because you have to first upload the files to the workshop using a publishing tool like GMPU (Garry’s Mod Publishing Utility) or GMAD (Which is found in the bin folder of main Garry’s Mod directory folder).

This thing here http://steamcommunity.com/sharedfiles/filedetails/?id=104603291 will make your life easier. You can view legacy addon files, also materials and sounds, to check if GMod loads them or not. Also what SevenBillion said, check if you have your Materials named properly in smd/dmx

Thanks, guys.

Well, the path in my QC for my models is:


$cdmaterials "models/myusername/mytextures"

And my VMT is:


"VertexLitGeneric"
{
	"$basetexture" "models/myusername/mytextures"
}


All I can think of is that I have everything in the wrong folder. I have my username folder in the addons folder, with the models and materials subfolder in there. Should they be in the materials and models folder instead of the addons folder or something?

Also, that extended spawn menu thing looks good. I’ll subscribe right away.

The basetexture parameter should point to a VTF file, but your points to a directory. It should be something like



"$basetexture" "models/myusername/mytextures/texture1"


and a file called texture1.vtf should be in that folder

I think my problem is that I have my models and materials folder in my username folder instead of my username folder in a models folder (like I would with SFM). I’m gonna try that and see if that’s the issue.

Also, I thought that my basetexture parameter pointed to a directory, but I just didn’t write it correctly when I posted it here. It does point to the VTF file (without the extension, obviously).

[editline]26th August 2017[/editline]

I’m an idiot.

I needed to have a models folder in my materials folder. Now it’s working fine! Thanks so much for all your help, everyone!