Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: 1 [2] 3 4 ... 6

Author Topic: 57' Chevy Belair  (Read 41926 times)

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: 57' Chevy Belair
« Reply #15 on: April 22, 2013, 01:46:02 pm »

Ill work on that later.. Now I just need someone to model a 1958 Plymouth Fury..



God, do I love that car.
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #16 on: April 22, 2013, 02:32:52 pm »

hehe, well, I'm looking to make another car :)

I was thinking of many different ones I could make. 

 - Hearse
 - Bus
 - Model T or similar era car
 - 66 Chevy Nova SS
Logged

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #17 on: April 22, 2013, 07:29:23 pm »

Think I might make this. Looks badass.

Logged

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #18 on: April 23, 2013, 09:48:04 am »

I think what I can do/what can be done on this belair too, would be to make 2 wheel Params, and set the front to slip less and rear to slip more.  I'm not sure it's currently rear wheel drive in-engine either, I think it might be FWD?
Logged

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: 57' Chevy Belair
« Reply #19 on: April 23, 2013, 11:26:16 am »

Looks RWD from my testing. Unless it is all wheel drive.. TO THE CODE!!

Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #20 on: April 23, 2013, 11:42:20 am »

It shouldn't be 4x4, but I copied the BMW code in and modded it a bit.  So it is probably whatever that was.
Logged

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: 57' Chevy Belair
« Reply #21 on: April 23, 2013, 03:52:28 pm »

Ok, I rubbed this down with my magic stick for two hours.

Code: [Select]
//vehicle script file
//see http://xtrac.outerra.com/index.fcgi/wiki/vehicle for example and documentation

//ENGINE Template/Code by ZeosPantera of Outerra Forum.

//invoked only the first time the model is loaded, or upon reload
function init_chassis(){

   var wheelparam2 =
    {
        radius: 0.34, //<-- edit this to 0.3 (remember our wheel radius of 30cm!)
        width: 0.15, //<-- edit this to 0.2 (this represents the height parameter in 3d max of 20cm!)
        suspension_max: 0.3,
        suspension_min: -0.1,
        suspension_stiffness: 20,
        damping_compression: 0.1,
        damping_relaxation: 0.3,
        slip: 0.65,  //0.8
        roll_influence: 0.1,
rotation: -1.0
   };
       
//http://www.outerra.com/forum/index.php?topic=1561.msg17833#msg17833
//Wheelbase 115"
//Length 195.6"    
//V8 Bel Air with Powerglide as being 0-60 mph in 12.9 seconds

    this.add_wheel('wheel_rf_L0',wheelparam2); //<-- the name "wheel_FR" is the name you used for your wheel in 3d max
    this.add_wheel('wheel_lf_L0',wheelparam2);
    //this.add_wheel_swing('suspension_rf_L0', 'wheel_rf_L0', wheelparam);
//this.add_wheel_swing('suspension_lf_L0', 'wheel_lf_L0', wheelparam);
this.add_wheel('wheel_rr_L0',wheelparam2);
    this.add_wheel('wheel_lr_L0',wheelparam2);



this.load_sound("belair_startup.ogg"); //startup
    this.load_sound("belair_onidle.ogg"); //idle
    this.load_sound("e90_offlow.ogg");    //off
    this.load_sound("e90_onlow.ogg"); //on
    this.basepitch = [ 0.3, 0.85, 0.25, 0.25 ];             //base pitch for start, idle, throttle
    this.add_sound_emitter("wheel_lf_L0");

    //engine properties -- modify these to change the engine behaviour
    this.wheelRadius = 0.34;

    this.torquePoints = [ { rpm: 0,    torque: 1080},
                          { rpm: 1000, torque: 1120},
                          { rpm: 2000, torque: 1235},
                          { rpm: 3000, torque: 1380},
                          { rpm: 4000, torque: 1400},
                          { rpm: 5000, torque: 1415},
                          { rpm: 6000, torque: 1400},
                          { rpm: 7000, torque: 0},
                          { rpm: 8000, torque: 0},
                          { rpm: 9000, torque: 0  } ];

    this.forwardGears = [ { ratio: 4.00, shiftUp: 5000, shiftDown: -1   },
                          { ratio: 3.00, shiftUp: 5000, shiftDown: 2500 },
                          { ratio: 2.00, shiftUp: 5000, shiftDown: 3000 },
                          { ratio: 1.50, shiftUp: 5000, shiftDown: 3000 },
                          { ratio: 1.00, shiftUp: -1,   shiftDown: 3000 } ];
    this.reverseGears = [ { ratio: 4.20, shiftUp: -1, shiftDown: -1 } ];

    this.finalRatio = 4;
    this.torqueMultiplier = 2.25;
    this.maximumSpeed = -1; // speed in m/s. a value < 0 means there's no maximum speed
    this.engineBrakeCoefficient = 0.1;
    this.breakingForce = 3800.0;
    this.pitchMultiplier = 0.6;
    //end of engine properties

    this.maxPowerTP = this.torquePoints[0];
    this.maxRPM = 5800;
    var maxPw = 0;
    for (var i = 1; i < this.torquePoints.length; ++i) {
        var tp = this.torquePoints[i];
        if (tp.rpm * tp.torque > maxPw) {
            this.maxPowerTP = tp;
        }
        if (tp.rpm > this.maxRPM) {
            this.maxRPM = tp.rpm;
        }
    }

    this.neutroGear = { ratio: 0.0, shiftUp: -1, shiftDown: -1, index: 0 };
    var prev = null;
    for (var i = 0; i < this.forwardGears.length; ++i) {
        var gear = this.forwardGears[i];
        if (prev)
            prev.next = gear;
        gear.prev = prev;
        gear.index = i + 1;
        prev = gear;
    }

    prev = null;
    for (var i = 0; i < this.reverseGears.length; ++i) {
        var gear = this.reverseGears[i];
        if (prev)
            prev.next = gear;
        gear.prev = prev;
        gear.index = -i - 1;
        prev = gear;
    }


    this.torque = engineTorque;

    return {mass:1570, steering:1.0, steering_ecf:10000, centering: 2.0, centering_ecf: 10, com:{y:0.2, z:0.1}};
}

//invoked for each new instance of the vehicle
function init_vehicle() {
    this.set_fps_camera_pos({x:-0.34,y:-0.38,z:0.70});

this.geom = this.get_geomob(0)
this.swheel = this.geom.get_joint("steering_Wheel_center_L0");
//this.geom = this.get_mesh_id("steering_Wheel_center_L0")

    this.snd = this.sound();
    this.snd.set_ref_distance(0, 9.0);

    this.started = false;
    this.gear = this.neutroGear;
    this.direction = 0;
}

//invoked when engine starts or stops
function engine(start) {
    if (start) {
        this.started = true;
        this.sound = 0;
        this.snd.play(0, 0, false, false);
    }
}

function engineTorque(rpm) {
    var min = 0;
    var max = this.torquePoints.length - 1;

    if (rpm > this.torquePoints[max].rpm || rpm < this.torquePoints[min].rpm)
        return 0;

    while (max - min > 1) {
        var mid = Math.floor(min + (max - min) / 2);
        var tp = this.torquePoints[mid];
        if (tp.rpm == rpm) {
            return tp.torque;
        } else if (tp.rpm > rpm) {
            max = mid;
        } else {
            min = mid;
        }
    }

    var minTp = this.torquePoints[min];
    var maxTp = this.torquePoints[max];
    var TM = maxTp.torque;
    var Tm = minTp.torque;
    var RM = maxTp.rpm;
    var Rm = minTp.rpm;

    var a = (TM - Tm) / (RM - Rm);

    return rpm * a + Tm - Rm * a;
}

function sign(x) {
    return (x > 0.0 ? 1 : (x < 0.0 ? -1 : 0));
}

//invoked each frame to handle the inputs and animate the model
function update_frame(dt, engine, brake, steering) {
    if (!this.started)
        return;

    if (this.sound == 0 && this.snd.is_playing(0)) { // still starting up
        return;
    }

    steering *= 0.65;
    this.steer(-2, steering);

var steerAngle = steering *= 6.05;
this.geom.rotate_joint_orig(this.swheel, steerAngle, {x:0,y:0,z:1});

    var absSpeed = Math.abs(this.speed());
    var khm = absSpeed * 3.6;
    var wheels = absSpeed / (this.wheelRadius * (2 * Math.PI));

    //automatic gear shifting
    var rpm = wheels * this.gear.ratio * this.finalRatio * 60;
    if (rpm < 5 && this.gear.index != 0) {
        this.gear = this.neutroGear;
        this.direction = 0;
//         this.log_inf("neutro");
    }
    if (engine != 0.0 && sign(engine) != this.direction) {
        this.direction = sign(engine);
        if (this.direction == 1.0) {
            this.gear = this.forwardGears[0];
//             this.log_inf("forward, gear " + this.gear.index);
        } else if (this.direction == -1.0) {
            this.gear = this.reverseGears[0];
//             this.log_inf("reverse, gear " + this.gear.index);
        }
        rpm = wheels * this.gear.ratio * this.finalRatio * 60;
    }

    if (rpm > this.gear.shiftUp && this.gear.next) {
        this.gear = this.gear.next;
//         this.log_inf("gear up " + this.gear.index);
    } else if (rpm < this.gear.shiftDown && this.gear.prev) {
        this.gear = this.gear.prev;
//         this.log_inf("gear down " + this.gear.index);
    }

    rpm = wheels * this.gear.ratio * this.finalRatio * 60;

    if (this.maximumSpeed < 0 || this.speed < this.maximumSpeed) {
        var force = engine * this.torque(rpm) * this.torqueMultiplier * this.gear.ratio;
        this.wheel_force(2, force);
        this.wheel_force(3, force);
    }

    //From Torcs engine code
    var static_friction = 0.1;
    var engineBrake = this.maxPowerTP.torque * this.engineBrakeCoefficient * this.torqueMultiplier * this.gear.ratio *
                      (static_friction + (1.0 - static_friction) * rpm / this.maxRPM);

    brake *= this.breakingForce;
    this.wheel_brake(-1, brake + engineBrake);

    this.animate_wheels();

    if (this.gear.index == 0 && (!this.snd.is_playing(0) || this.sound != 1)) {
        this.snd.stop(0);
        this.snd.play(0, 1, true, false);
        this.sound = 1;
    } else if (this.gear.index != 0 && engine == 0 && (!this.snd.is_playing(0) || this.sound != 2)) { //idle
        this.snd.stop(0);
        this.snd.play(0, 2, true, false);
        this.sound = 2;
    } else if (this.gear.index != 0 && engine != 0 && (!this.snd.is_playing(0) || this.sound != 3)) { //throttle
        this.snd.stop(0);
        this.snd.play(0, 3, true, false);
        this.sound = 3;
    }

    var pitch = this.pitchMultiplier * rpm / this.maxRPM;
    this.snd.set_pitch(0, pitch + this.basepitch[this.sound]);
}

I am starting to get the hang of how odd this coding system works..

One of the biggest issues is that the sound doesn't correspond with the wheels spinning. So I am ramping up the torque to burnout levels and the vehicles emits the same slow movement sounds. Is there a way to have the sound alter pitch based on the actual wheels rotating?
« Last Edit: April 23, 2013, 05:00:58 pm by ZeosPantera »
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

Chaoz

  • Full Member
  • ***
  • Posts: 156
  • newbie
Re: 57' Chevy Belair
« Reply #22 on: April 23, 2013, 03:54:03 pm »

pls refrain from touching anything with your "magic stick"... :D
Logged

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #23 on: April 23, 2013, 04:20:37 pm »

Is there a way to set the FOV for the FP camera?  I know we can set the position.  But it would be nice to be able to widen the FOV a bit. 
Logged

deathevor

  • Sr. Member
  • ****
  • Posts: 265
  • User
    • Sk-Films
Re: 57' Chevy Belair
« Reply #24 on: April 23, 2013, 07:15:08 pm »

In game graphics menu.
But also thought if it's possible to set it in script (individually for each vehicle).
Logged
VFx Artist/Supervisor, Private Pilot - www.sk-films.com

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #25 on: April 23, 2013, 07:45:06 pm »

Yeah. I wanted to set for my specific car. Maybe it's just a code update to check if in FP mode of the vehicle like camera pos.  Then it picks up the custom fov
Logged

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: 57' Chevy Belair
« Reply #26 on: April 23, 2013, 11:16:37 pm »

Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: 57' Chevy Belair
« Reply #27 on: April 23, 2013, 11:34:22 pm »

Haha. Nice. Hydraulics
Logged

Juggernautz

  • Jr. Member
  • *
  • Posts: 48
  • newbie
Re: 57' Chevy Belair
« Reply #28 on: April 24, 2013, 12:55:10 am »

Hahaha. Zeos, you are a God amongst men. Looks like you've got the springy powerup from Carmageddon. ;)
Logged

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: 57' Chevy Belair
« Reply #29 on: April 24, 2013, 02:58:55 am »

Don't quite know what to make of this car. The bounding box of the suspension must be messing with it. Even allowing a full meter of upward travel on the suspension she still flips out (very literally) when you are going fast across terrain. I did manage to get the multiple gear system working.

STILL LOOKING TO MOVE THE SOUND EFFECTS TO WHEEL RPM!! and not speed through the air.
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo
Pages: 1 [2] 3 4 ... 6