car drives sideways and flies when try to turn. Custom rigging attempt.



$keyvalues
{

    "vehicle_exit"
    {
        // Entries are: Key = exit animation, Value = "upright" or "upsidedown"
        "exit1"    "upright"
        "exit2"    "upright"
        "exit7"    "upsidedown"
        "exit8"    "upsidedown"
    }


}

//----- Attachments -----
$attachment wheel_fl "als.wheel.fl" 0 0 -8
$attachment wheel_fr "als.wheel.fr" 0 0 -8
$attachment wheel_rl "als.wheel.rl" 0 0 -8
$attachment wheel_rr "als.wheel.rr" 0 0 -8
$attachment "vehicle_driver_eyes" "als.body" -19.00 -10.00 52.00 rotate -90 -0 0
$attachment "exit1" "als.body" -70.00 10.00 44.00 rotate 90 90 0
$attachment "exit2" "als.body" 70.00 10.00 44.00 rotate 90 90 0
$attachment "exit7" "als.body" -70.00 50.00 2.00 rotate -90 -90 0
$attachment "exit8" "als.body" 70.00 50.00 2.00 rotate -90 -90 0
$attachment "vehicle_feet_passenger0" "als.body" -18.00 -8.00 17.00 rotate 0 90 0
$attachment "vehicle_engine" "als.body" 0.00 66.00 25.00 rotate 0 0 0
$attachment "headlight_l" "als.body" -29.00 98.00 24.00 rotate 0 90 0
$attachment "headlight_r" "als.body" 29.00 98.00 24.00 rotate 0 90 0
$attachment "rearlight_l" "als.body" -29.00 -106.00 33.00 rotate 0 -90 0
$attachment "rearlight_r" "als.body" 29.00 -106.00 33.00 rotate 0 -90 0
$attachment "exhaust_l" "als.body" 43.00 -12.00 6.00 rotate 0 0 0
$attachment "exhaust_r" "als.body" 43.00 -17.00 6.00 rotate 0 -15 0


//----- Pose Parameters -----


$poseparameter "vehicle_steer" -1 1
$poseparameter "vehicle_wheel_fl_height" 0 1
$poseparameter "vehicle_wheel_fr_height" 0 1 
$poseparameter "vehicle_wheel_rl_height" 0 1  
$poseparameter "vehicle_wheel_rr_height" 0 1

$poseparameter "vehicle_wheel_fl_spin" -180 180 wrap
$poseparameter "vehicle_wheel_fr_spin" -18- 180 wrap
$poseparameter "vehicle_wheel_rl_spin" -180 180 wrap
$poseparameter "vehicle_wheel_rr_spin" -180 180 wrap

// --------- Animation sequences -------

$sequence "idle" "bmw_ref" fps 30 ACT_IDLE 1 //addlayer aim_all
$sequence "turn" "bmw_turn" fps 30
$sequence "suspension" "bmw_height" fps 30
$sequence "spin" "bmw_spin" fps 30



$animation neutral "bmw_ref" frames 0 0



// front steering sequence
$weightlist front_wheels { "als.wheel.fl_turn" 1.0 "als.wheel.fr_turn" 1.0 "als.steer" 1.0 }
$animation turn_left "bmw_turn" frame 0 0 subtract neutral 0 weightlist front_wheels 
$animation turn_right "bmw_turn" frame 2 2 subtract neutral 0 weightlist front_wheels 
$sequence turning { turn_left turn_right blend vehicle_steer -1 1 } weightlist front_wheels delta autoplay

// front right
$weightlist wheel_fr { "als.wheel.fr_axel" 1.0 "als.wheel.fr" 0.0  }
$animation wheel_fr_low "bmw_height" frame 0 0 subtract neutral 0 weightlist wheel_fr 
$animation wheel_fr_high "bmw_height" frame 2 2 subtract neutral 0 weightlist wheel_fr 
$sequence wheel_fr_suspension { wheel_fr_low wheel_fr_high blend "vehicle_wheel_fr_height" 0 1.0 } weightlist wheel_fr delta autoplay

$weightlist wheel_fr_spin { "als.wheel.fr" 1.0 }
$animation wheel_fr_spin0 "bmw_spin" frame 0 0 subtract neutral 0 weightlist wheel_fr_spin 
$animation wheel_fr_spin120 "bmw_spin" frame 3 3 subtract neutral 0 weightlist wheel_fr_spin
$animation wheel_fr_spin240 "bmw_spin" frame 6 6 subtract neutral 0 weightlist wheel_fr_spin
$sequence wheel_fr_spin { wheel_fr_spin0 wheel_fr_spin120 wheel_fr_spin240 wheel_fr_spin0 blendwidth 4 blend "vehicle_wheel_fr_spin" -180 180 } weightlist wheel_fr_spin delta autoplay

// front left
$weightlist wheel_fl { "als.wheel.fl_axel" 1.0 "als.wheel.fl" 0.0 }
$animation wheel_fl_low "bmw_height" frame 0 0 subtract neutral 0 weightlist wheel_fl 
$animation wheel_fl_high "bmw_height" frame 2 2 subtract neutral 0 weightlist wheel_fl 
$sequence wheel_fl_suspension { wheel_fl_low wheel_fl_high blend "vehicle_wheel_fl_height" 0 1.0 } weightlist wheel_fl delta autoplay

$weightlist wheel_fl_spin { "als.wheel.fl" 1.0 } 
$animation wheel_fl_spin0 "bmw_spin" frame 0 0 subtract neutral 0 weightlist wheel_fl_spin 
$animation wheel_fl_spin120 "bmw_spin" frame 3 3 subtract neutral 0 weightlist wheel_fl_spin 
$animation wheel_fl_spin240 "bmw_spin" frame 6 6 subtract neutral 0 weightlist wheel_fl_spin 
$sequence wheel_fl_spin { wheel_fl_spin0 wheel_fl_spin120 wheel_fl_spin240 wheel_fl_spin0 blendwidth 4 blend "vehicle_wheel_fl_spin" -180 180 } weightlist wheel_fl_spin delta autoplay

// rear right
$weightlist wheel_rr { "als.wheel.rr_axel" 1.0 "als.wheel.rr" 0.0 }
$animation wheel_rr_low "bmw_height" frame 0 0 subtract neutral 0 weightlist wheel_rr 
$animation wheel_rr_high "bmw_height" frame 2 2 subtract neutral 0 weightlist wheel_rr 
$sequence wheel_rr_suspension { wheel_rr_low wheel_rr_high blend "vehicle_wheel_rr_height" 0 1.0 } weightlist wheel_rr delta autoplay

$weightlist wheel_rr_spin { "als.wheel.rr" 1.0 } 
$animation wheel_rr_spin0 "bmw_spin" frame 0 0 subtract neutral 0 weightlist wheel_rr_spin 
$animation wheel_rr_spin120 "bmw_spin" frame 3 3 subtract neutral 0 weightlist wheel_rr_spin 
$animation wheel_rr_spin240 "bmw_spin" frame 6 6 subtract neutral 0 weightlist wheel_rr_spin 
$sequence wheel_rr_spin { wheel_rr_spin0 wheel_rr_spin120 wheel_rr_spin240 wheel_rr_spin0 blendwidth 4 blend "vehicle_wheel_rr_spin" -180 180 } weightlist wheel_rr_spin delta autoplay

// rear left
$weightlist wheel_rl { "als.wheel.rl_axel" 1.0 "als.wheel.rl" 0.0 }
$animation wheel_rl_low "bmw_height" frame 0 0 subtract neutral 0 weightlist wheel_rl 
$animation wheel_rl_high "bmw_height" frame 2 2 subtract neutral 0 weightlist wheel_rl 
$sequence wheel_rl_suspension { wheel_rl_low wheel_rl_high blend "vehicle_wheel_rl_height" 0 1.0 } weightlist wheel_rl delta autoplay

$weightlist wheel_rl_spin { "als.wheel.rl" 1.0 }
$animation wheel_rl_spin0 "bmw_spin" frame 0 0 subtract neutral 0 weightlist wheel_rl_spin 
$animation wheel_rl_spin120 "bmw_spin" frame 3 3 subtract neutral 0 weightlist wheel_rl_spin 
$animation wheel_rl_spin240 "bmw_spin" frame 6 6 subtract neutral 0 weightlist wheel_rl_spin 
$sequence wheel_rl_spin { wheel_rl_spin0 wheel_rl_spin120 wheel_rl_spin240 wheel_rl_spin0 blendwidth 4 blend "vehicle_wheel_rl_spin" -180 180 } weightlist wheel_rl_spin delta autoplay

//----- Physbox -----

$collisionmodel "bmw_col.smd" {
     // Mass in kilograms
         $Mass 600
    $concave

    }
$modelname        "als/fl/beha.mdl"
$cd                "C:\Users\arleitiss\Desktop\123"
$body "Body" bmw_ref.smd
$cdmaterials "als/fl/"
$surfaceprop    "metal"
$texturegroup bmw
{
    { "bmw1"  }
    { "bmw2" }
    { "bmw3"  }
    { "bmw4" }
    { "bmw5"  }
    { "bmw6" }
    { "bmw7" }
}

What’s wrong with it? everything is rigged fine. In mdl viewer wheels spin and turn etc…
But when in game spawned, it drives sideways. So if I hold “W” it goes sideways. And if hold “S” it goes sideways other direction. When pressing “A” or “D” it just spins and messes up. Any help? Thanks.

Did you try decompiling an existing vehicle in order to build this one? Some of your SMDs have apparently gotten rotated 90°. Try making a duplicate of your *.qc (for debugging) and replace all of the sequences with your reference SMD. (“bmw_ref”). If it’s still sideways, you can rotate it and see immediate results.

In future, don’t decompile vehicles in order to make new ones. Valve thoughtfully included the uncompiled resources for their Buggy and Airboat models in the *\sourcesdk_content\hl2\modelsrc* folder.

I used buggy by valve. And that’s the result. Also where is rotated smd’s ?
I only see rotated animations. Or is it same thing?

For testing purposes change this:


// --------- Animation sequences -------

$sequence "idle" "bmw_ref" fps 30 ACT_IDLE 1 //addlayer aim_all
$sequence "turn" "bmw_turn" fps 30
$sequence "suspension" "bmw_height" fps 30
$sequence "spin" "bmw_spin" fps 30

to


// --------- Animation sequences -------

$sequence "idle" "bmw_ref" fps 30 ACT_IDLE 1 //addlayer aim_all
$sequence "turn" "bmw_ref fps 30
$sequence "suspension" "bmw_ref" fps 30
$sequence "spin" "bmw_ref" fps 30


If the model is still sideways, you’ll be able to rotate the reference SMD and see universal results. Once you’ve got it facing in the right direction, you can build your animations off of it.

Still can’t get it to work. It just keeps flying. But now instead of driving side ways. It just stands on same spot.

Try putting this code in your qc


$origin 0 0 0 90

This may help you, it’s what I use in all my vehicle models. Make sure you put it very close to the beginning of your qc, otherwise it may not work properly.

Also I would recommend putting this part of your qc at the beginning rather than the end:


$modelname        "als/fl/beha.mdl"
$cd                "C:\Users\arleitiss\Desktop\123"
$body "Body" bmw_ref.smd
$cdmaterials "als/fl/"
$surfaceprop    "metal"
$texturegroup bmw
{
    { "bmw1"  }
    { "bmw2" }
    { "bmw3"  }
    { "bmw4" }
    { "bmw5"  }
    { "bmw6" }
    { "bmw7" }
}

When you add the $origin command it should look like this:


$modelname        "als/fl/beha.mdl"
$cd                "C:\Users\arleitiss\Desktop\123"
$origin 0 0 0 90
$body "Body" bmw_ref.smd
$cdmaterials "als/fl/"
$surfaceprop    "metal"
$texturegroup bmw
{
    { "bmw1"  }
    { "bmw2" }
    { "bmw3"  }
    { "bmw4" }
    { "bmw5"  }
    { "bmw6" }
    { "bmw7" }
}

I hope this helps.

There I made video of problem.

[editline]15th February 2011[/editline]

ok everything works fine now. Thanks everyone.
Though another problem, all wheels are kinda jiggly. And car flips it self on turns. And can’t drive properly. All jiggly and bouncy.


// This is the 2nd Sexiest Lambo Ever Made.

"vehicle"
{
    "wheelsperaxle"    "2"
    "body"
    {
        "countertorquefactor"    "1.0"
        "massCenterOverride"    "0 0 0"
        "massoverride"        "500"        // kg
        "addgravity"        "0.7"
    }
    "engine"
    {
        "horsepower"        "700"
        "maxrpm"        "5600"
        "maxspeed"        "440"        // mph
        "maxReverseSpeed"    "40"        // mph
        "autotransmission"    "1"
        "axleratio"        "4.56"
        "gear"            "1.86"        // 1st gear
        "gear"            "1.59"        // 2nd gear
        "gear"            "1.17"        // 3rd gear
        "gear"            "1.0"        // 4th gear
        "gear"            "0.84"        // 5th gear
        "shiftuprpm"        "3500"
        "shiftdownrpm"        "1000"
    
        "boost"
        {
//            "force"        "1.2"    // 1.5 car body mass * gravity * inches / second ^ 2
            "duration"    "1.0"    // 1 second of boost
            "delay"        "15"    // 15 seconds before you can use it again
            "torqueboost"    "8"    // enable "sprint" mode of vehicle, not    force type booster            
            "maxspeed"    "155"    // maximum turbo speed
            "force"        "1.2"    // use for value as a boost factor
        }
    }
    "steering"
    {
        "degreesSlow"        "45"    // steering cone at zero to slow speed
        "degreesFast"        "40"    // steering cone at fast speed to max speed
        "degreesBoost"        "9"    // steering cone at max boost speed (blend toward this after max speed)
        "steeringExponent"    "2.4"    // steering function is linear, then raised to this power to be slower at the beginning of the curve, faster at the end
        "slowcarspeed"        "15"
        "fastcarspeed"        "60"
        "slowSteeringRate"    "8.0"        
        "fastSteeringRate"    "6.0"
        "steeringRestRateSlow"    "4.0"
        "steeringRestRateFast"    "2.0"
        "turnThrottleReduceSlow" "0.1"
        "turnThrottleReduceFast" "0.5"
        "brakeSteeringRateFactor"    "6"
        "throttleSteeringRestRateFactor"    "2"
        "boostSteeringRestRateFactor"    "1.7"
        "boostSteeringRateFactor"    "1.7"

        "powerSlideAccel"    "50"

        "skidallowed"        "0"
        "dustcloud"        "1"

    }
    
    // front axle
    "axle"
    {
        "wheel"
        {
            "radius"    "18"
            "mass"        "100"
            "inertia"    "1"        // steady the car (fixes the oscillation of the axles about z)
            "damping"    "0"
            "rotdamping"    "0.0"
            "material"    "enzotire"
            "skidmaterial"    "enzotire"
            "brakematerial" "enzotire"
        }
        "suspension"
        {
            "springConstant"        "150"
            "springDamping"            "4"
            "stabilizerConstant"        "10"
            "springDampingCompression"    "2"
            "maxBodyForce"            "550"
        }

        "torquefactor"    "0.9"
        "brakefactor"    "0.7"
    }

    // rear axle
    "axle"
    {
        "wheel"
        {
            "radius"    "18.5"
            "mass"        "150"
            "inertia"    "2.5"        // steady the car (fixes the oscillation of the axles about z)
            "damping"    "0"
            "rotdamping"    "0.0"
            "material"    "rigmtire"
            "skidmaterial"    "rigmtire"
            "brakematerial" "rigmtire"
        }
        "suspension"
        {
            "springConstant"        "150"
            "springDamping"            "4"
            "stabilizerConstant"        "20"
            "springDampingCompression"    "2"
            "maxBodyForce"            "700"
        }
        "torquefactor"    "0.1"
        "brakefactor"    "0.3"
    }
}

"vehicle_sounds"
{
    // List gears in order from lowest speed to highest speed

    "gear"
    {
        "max_speed"        "0.3"
        "speed_approach_factor" "1.0"
    }

    "gear"
    {
        "max_speed"        "0.5"
        "speed_approach_factor" "0.07"
    }
    "gear"
    {
        "max_speed"        "0.75"
        "speed_approach_factor" "0.07"
    }
    "gear"
    {
        "max_speed"        "0.80"
        "speed_approach_factor" "0.035"
    }
    "gear"
    {
        "max_speed"        "0.90"
        "speed_approach_factor" "0.015"
    }
    "gear"
    {
        "max_speed"        "1.0"
        "speed_approach_factor" "0.03"
    }
    "state"
    {
        "name"        "SS_START_WATER"
        "sound"        "lambo2_start_in_water"
    }

    "state"
    {
        "name"        "SS_START_IDLE"
        "sound"        "lambo2_engine_start"
        "min_time"    "2.0"
    }
    "state"
    {
        "name"        "SS_SHUTDOWN_WATER"
        "sound"        "lambo2_stall_in_water"
    }
    "state"
    {
        "name"        "SS_IDLE"
        "sound"        "lambo2_engine_idle"
    }
    "state"
    {
        "name"        "SS_REVERSE"
        "sound"        "lambo2_reverse"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_GEAR_0"
        "sound"        "lambo2_rev"
        "min_time"    "0.75"
    }
    "state"
    {
        "name"        "SS_GEAR_0_RESUME"
        "sound"        "lambo2_engine_idle"
        "min_time"    "0.75"
    }
    "state"
    {
        "name"        "SS_GEAR_1"
        "sound"        "lambo2_firstgear"
        "min_time"    "0.20"
    }
    "state"
    {
        "name"        "SS_GEAR_1_RESUME"
        "sound"        "lambo2_throttlebackonlow"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_GEAR_2"
        "sound"        "lambo2_secondgear"
        "min_time"    "0.20"
    }
    "state"
    {
        "name"        "SS_GEAR_2_RESUME"
        "sound"        "lambo2_throttlebackon"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_GEAR_3"
        "sound"        "lambo2_thirdgear"
        "min_time"    "0.25"
    }
    "state"
    {
        "name"        "SS_GEAR_3_RESUME"
        "sound"        "lambo2_throttlebackon"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_GEAR_4"
        "sound"        "lambo2_fourthgear"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_GEAR_4_RESUME"
        "sound"        "lambo2_fourthgear"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_SLOWDOWN_HIGHSPEED"
        "sound"        "lambo2_throttleoff_fastspeed"
    }
    "state"
    {
        "name"        "SS_SLOWDOWN"
        "sound"        "lambo2_throttleoff_slowspeed"
    }
    "state"
    {
        "name"        "SS_TURBO"
        "sound"        "lambo2_turbo_on"
        "min_time"    "0.5"
    }
    "state"
    {
        "name"        "SS_SHUTDOWN"
        "sound"        "lambo2_engine_stop"
    }
    "crashsound"
    {
        "min_speed"            "350"
        "min_speed_change"    "250"
        "sound"                "ATV_impact_medium"
        "gear_limit"        "1"
    }
    "crashsound"
    {
        "min_speed"            "450"
        "min_speed_change"    "350"
        "sound"                "ATV_impact_heavy"
    }

    
    "skid_lowfriction"        "ATV_skid_lowfriction"
    "skid_normalfriction"    "ATV_skid_normalfriction"
    "skid_highfriction"        "ATV_skid_highfriction"
}


Help someone? I have no idea what that code does. Can someone write or edit it so it’s properly working?
thanks.