Vehicle modelling for HL2 mod.

I’ve been trying to get a tricycle into my half-life 2 mod.
I’ve followed a HL2world tutorial and the valve way (found in sourcesdk_content) and the VDC.
I still have an issue with the vehicle flipping out and its collisions completely breaking.
Here’s my current .qc


$modelname "buggy.mdl"


$bodygroup "Body"
{
	studio "trike_ref.smd"
}



$cdmaterials "models\buggy\"
$cdmaterials "models	rike\"

// This list shows the VMT files used in the SMD files.
// "ammo_box.vmt"
// "buggy001.vmt"

$attachment wheel_fl "Rig_Buggy.Wheel_FL" 0 0 8
$attachment wheel_fr "Rig_Buggy.Wheel_FR" 0 0 8
$attachment wheel_rl "Rig_Buggy.Wheel_RL" 0 0 8
$attachment wheel_rr "Rig_Buggy.Wheel_RR" 0 0 8
$attachment "vehicle_driver_eyes" "Rig_Buggy.view" 5 0 0 rotate 0 0 0
$attachment "vehicle_engine" "Rig_Buggy.Frame" 0 0 -40 rotate 0 0 0
$attachment "exit1" "Rig_Buggy.Frame" 69.43 27.95 28.02 rotate -90 -90 0
$attachment "exit2" "Rig_Buggy.Frame" -69.43 27.95 28.02 rotate -90 -90 0
$attachment "exit3" "Rig_Buggy.Frame" 5.61 70.95 52.93 rotate -90 -90 0
$attachment "exit4" "Rig_Buggy.Frame" 0 27.95 -110.09 rotate -90 -90 0
$attachment "exit5" "Rig_Buggy.Frame" 0 -74.18 -11.98 rotate -67.83 90 0
$attachment "exit6" "Rig_Buggy.Frame" 0 -74.18 -11.98 rotate -67.83 90 0
$attachment "exit7" "Rig_Buggy.Frame" 70.21 -14.14 -1.04 rotate -51.46 -165.29 -104.71
$attachment "exit8" "Rig_Buggy.Frame" -70.21 -14.14 3.99 rotate -49.87 -14.71 104.71
$attachment "enter1" "Rig_Buggy.Frame" 69.43 19.95 -1.98 rotate 0 180 90
$attachment "enter2" "Rig_Buggy.Frame" -69.43 19.95 -1.98 rotate 0 0 -90
$attachment "enter3" "Rig_Buggy.Frame" 5.61 62.95 81.37 rotate 55.44 -90 180
$attachment "enter4" "Rig_Buggy.Frame" 0 19.95 -110.09 rotate -90 -90 0


$poseparameter "vehicle_wheel_fl_spin" -180 180 wrap
$poseparameter "vehicle_wheel_fr_spin" -180 180 wrap
$poseparameter "vehicle_wheel_rl_spin" -180 180 wrap
$poseparameter "vehicle_wheel_rr_spin" -180 180 wrap
$poseparameter vehicle_steer -1 1

$animation idle_anim "anims/idle" 

$animation spin_anim000 "anims/idle"   subtract idle_anim 0

$animation spin_anim_fr120 "anims/car_spin_fr120" subtract idle_anim 0
$animation spin_anim_fr240 "anims/car_spin_fr240" subtract idle_anim 0
$animation spin_anim_fl120 "anims/car_spin_fl120" subtract idle_anim 0
$animation spin_anim_fl240 "anims/car_spin_fl240" subtract idle_anim 0
$animation spin_anim_rr120 "anims/car_spin_rr120" subtract idle_anim 0
$animation spin_anim_rr240 "anims/car_spin_rr240" subtract idle_anim 0
$animation spin_anim_rl120 "anims/car_spin_rl120" subtract idle_anim 0
$animation spin_anim_rl240 "anims/car_spin_rl240" subtract idle_anim 0

$animation steer_anim0 "anims/car_steer0" subtract idle_anim 0
$animation steer_anim1 "anims/car_steer1" subtract idle_anim 0

// This is the blended sequence which describes how to rotate the front right wheel
$sequence wheel_fr_spin spin_anim000 fps 30  {
  blend vehicle_wheel_fr_spin -180 180 
  blendwidth 4
  delta
  autoplay
  spin_anim_fr240 spin_anim_fr120 spin_anim000 
} 

// This is the blended sequence which describes how to rotate the front left wheel
$sequence wheel_fl_spin spin_anim000 fps 30 {
  blend vehicle_wheel_fl_spin -180 180 
  blendwidth 4
  delta
  autoplay
  spin_anim_fl240 spin_anim_fl120 spin_anim000 
} 

// This is the blended sequence which describes how to rotate the rear right wheel
$sequence wheel_rr_spin spin_anim000 fps 30  {
  blend vehicle_wheel_rr_spin -180 180 
  blendwidth 4
  delta
  autoplay
  spin_anim_rr240 spin_anim_rr120 spin_anim000 
} 

// This is the blended sequence which describes how to rotate the rear left wheel
$sequence wheel_rl_spin spin_anim000 fps 30  {
  blend vehicle_wheel_rl_spin -180 180 
  blendwidth 4
  delta
  autoplay
  spin_anim_rl240 spin_anim_rl120 spin_anim000 
} 

// This is the blended sequence which describes how to steer the front wheels
$sequence steer steer_anim0 fps 30  {
  blend vehicle_steer -1 1
  blendwidth 2
  delta
  autoplay
  steer_anim1 
} 

$surfaceprop "metal"

$sequence "enter1" "buggy_anims\enter1.smd" {
	fps 60
	snap
}

$sequence "exit1" "buggy_anims\exit1.smd" {
	fps 60
	fadeout 0
}

$sequence "enter2" "buggy_anims\enter2.smd" {
	fps 60
	snap
}

$sequence "exit2" "buggy_anims\exit2.smd" {
	fps 60
	fadeout 0
}

$sequence "enter3" "buggy_anims\enter3.smd" {
	fps 60
	snap
}

$sequence "exit3" "buggy_anims\exit3.smd" {
	fps 60
	fadeout 0
}

$sequence "enter4" "buggy_anims\enter4.smd" {
	fps 60
	snap
}

$sequence "exit4" "buggy_anims\exit4.smd" {
	fps 60
	fadeout 0
}

$sequence "exit5" "buggy_anims\exit5.smd" {
	fps 60
	fadeout 0
}

$sequence "exit6" "buggy_anims\exit6.smd" {
	fps 60
	fadeout 0
}

$sequence "exit7" "buggy_anims\exit7.smd" {
	fps 60
	fadeout 0
}

$sequence "exit8" "buggy_anims\exit8.smd" {
	fps 60
	fadeout 0
}


$collisionmodel "trike_physics.smd"
{
	$mass 800
	$inertia 1

}


$keyvalues
{
	vehicle_entry 
	{
		"enter1" "1"
		"enter2" "2"
		"enter3" "3"
	}
	vehicle_exit 
	{
		"exit1" "upright"
		"exit2" "upright"
		"exit7" "upsidedown"
		"exit8" "upsidedown"
	}
	vehicle_escape_exit 
	{
		"exit3" "upright"
		"exit4" "upright"
		"exit5" "upsidedown"
		"exit6" "upsidedown"
	}
}


It’s a mixture of code from the source_sdkcontent .qc, the decompiled jeep .qc and the hl2world tutorial .qc (found here https://forums.joe.to/viewtopic.php?f=162&t=27733)
The closest I’ve gotten is by following the animation tutorial from the HL2world tutorial, however the trike is still upside down and the back wheels spin around and flip out. The collision model is also to the side of the trike and isn’t aligned to the trike despite having been weighted to the skeleton.
Has anyone gotten a vehicle model working in source and is able to help me out? Would be much appreciated.

I’ve mainly fixed it, except the model is sideways ingame. Here are some screenshots of what’s going on:

http://images.akamai.steamusercontent.com/ugc/314493598657530144/823058630B3E23F83D7181DE969E994E364CE2C2/[/t]

[t]http://images.akamai.steamusercontent.com/ugc/314493598657529250/0CE7D6967F13F1206048F4A8CED0F32B66BC6364/

It looks like the game thinks its around the wrong way.

bump

the only thing I can think of that might fix your issue is using $origin to modify the origin of the compiled model.

That didn’t fix it; I have discovered another error also.
Sometimes if I get off the trike the collision model is rotated 90 degrees.

that just makes it weirder, and me more confused.
I still don’t know what’s causing your issue.

Here’s a video of what’s going on so you can see it better. I fixed the collision model rotating but I don’t know what I did.

So you already tried the “$origin” command? Because I had the same problem about a month ago, except my buggy was driving sideways (bouncing around just like your trike), and adding “$origin 0 0 0 90” to the QC fixed it.

Maybe you could try rotating your models in your 3D app to compensate the rotation given by the compiler.

I tried $origin and also rotating the reference and physics meshes to compensate for rotation, but nothing has worked.
If anyone wants to have a look at it, I’ve uploaded the entire folder with all the tricycle stuff in it. Blender files as well as the compile folder.

The current .qc is buggy.qc, trike save me.qc was another test (which didn’t work either lol).