Announcement

Collapse
No announcement yet.

Help with manual transmission

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I like your gearcurves method but all it is doing is makeing the engine spin faster and there would be no transission. It would work better coupled with gear ratios just changing the torque along the way to lower acceleration in the higher gears.

    Leave a comment:


  • replied
    ok heres a way to make a variable number of gears.
    theres some issues with the code; When you reverse, your speed is still affected by what gear you are in, which is silly
    but it should show (hopefully) why Torque Curves are better than gear ratios.
    you can think of them in the same way as the gear tweaky thing in gran turismo, OutVal being the Y and InVal being the X ( i think )


    Code:
    class GearTest extends VertPawn;
    
    
    var     int			NumManualGears;	//how many manual gears
    var	int			CurrentGear;	//Current Gear? :p
    
    var 	array<InterpCurve>      GearCurves;     //dynamic array of gear curves
    						//InterpCurves are a good way of
    						//giving different outputs
    						//depending on the input
    
    function BeginPlay()
    {
     super.BeginPlay();
     TorqueCurve = GearCurves[0]; //make sure we start with our 1st gear
    }
    
    function NextWeapon()
    {
     if (CurrentGear >= NumManualGears)	//dont do anything if we are already at
         return;				//the final gear
    
     CurrentGear ++;
     TorqueCurve = GearCurves[CurrentGear];
    }
    
    function PrevWeapon()
    {
     if (CurrentGear <= 0)			//dont do anything if we are already at
         return;				//the first gear
    
     CurrentGear --;
     TorqueCurve = GearCurves[CurrentGear];
    }
    
    defaultproperties
    {
         NumForwardGears=1 //set to 1 so it doesnt upset our gear system
         CurrentGear = 0
         NumManualGears = 3//make sure you have enuf GearCurves to cover this
    
         //this is a 3 point torque curve. what this basically does is let us
         //set up the gears so that in 1st gear its easy to get the car moving,
         //but at higher gears its much harder
         GearCurves(0)=(Points=((OutVal=27.000000),(InVal=2000.000000,OutVal=50.000000),(InVal=400.000000)))
         GearCurves(1)=(Points=((InVal=350.000000,OutVal=20.000000),(InVal=950.000000,OutVal=90.000000),(InVal=1100.000000)))
         GearCurves(2)=(Points=((InVal=800.000000,OutVal=75.000000),(InVal=1750.000000,OutVal=110.000000),(InVal=2000.000000)))
         GearCurves(3)=(Points=((InVal=1800.000000,OutVal=100.000000),(InVal=2750.000000,OutVal=130.000000),(InVal=6000.000000)))
         //this is an example of bad curves :D
    }

    you want your curves like this

    Leave a comment:


  • replied
    BUMP

    Leave a comment:


  • replied
    YES!

    It works thank you so much but i like the mouse wheel idea. Now how about for more gears. This would rock in unwheel! especially if you can switch between manual and auto. One more thing what if you can set the number of gears you want.

    EDIT: Never mind about the more than 2 but i still need help for selectable amount

    Code:
    //-----------------------------------------------------------
    // Faster Improved Scorpion by Smart_N00b
    // Help by BIG A and aquaticsheep
    //-----------------------------------------------------------
    class TurboScorpion extends ONSRV;
    
    var() float FWheelScale;
    var() float RWheelScale;
    var() float Gear1;
    var() float Gear2;
    var() float Gear3;
    var() float Gear4;
    var() float Gear5;
    var() float Gear6;
    var() int mgears;
    
    
    simulated function PostNetBeginPlay()
    {
    
    	WheelsScale = WheelsScale * FWheelScale;
    	WheelsScale = WheelsScale * RWheelScale;
    	SetBoneScale(0, RWheelScale, Wheels[0].BoneName);
    	SetBoneScale(1, RWheelScale, Wheels[1].BoneName);
    	SetBoneScale(2, FWheelScale, Wheels[2].BoneName);
    	SetBoneScale(3, FWheelScale, Wheels[3].BoneName);
    	Wheels[0].WheelRadius = Wheels[0].WheelRadius * RWheelScale;
    	Wheels[1].WheelRadius = Wheels[1].WheelRadius * RWheelScale;
    	Wheels[2].WheelRadius = Wheels[2].WheelRadius * FWheelScale;
    	Wheels[3].WheelRadius = Wheels[3].WheelRadius * FWheelScale;
    
    	SetBoneScale(4, 1.2, 'CarLSlider');
    	SetBoneScale(5, 1.2, 'CarRSlider');
    
    	Super.PostNetBeginPlay();
    
    }
    
    //Enhanced steering
    simulated function KApplyForce(out vector Force, out vector Torque)
    {
    	local KRigidBodyState rbState;
    	local Vector X,Y,Z;
    
    	super.KApplyForce(Force, Torque);
    
    	GetAxes(Rotation, X,Y,Z);
    	KGetRigidBodyState(rbState);
    
            if (((Steering > 0) && (rbState.AngVel.Z > 0.5))
    	|| ((Steering < 0) && (rbState.AngVel.Z < 0.5)))
    		Torque.Z = (rbState.AngVel.Z * -1) * (80 * abs(rbState.AngVel.Z));
    
    }
    
    
    function nextweapon()
    {
      mgears--;
      checkmygears();
    }
    
    function prevweapon()
    {
      mgears++;
      checkmygears();
    }
    
    simulated function checkmygears()
    {
      if (mgears == 1)
      {
      GearRatios[1] = Gear1;
      }
      if (mgears == 2)
      {
      GearRatios[1] = Gear2;
      }
      if (mgears == 3)
      {
      GearRatios[1] = Gear3;
      }
      if (mgears == 4)
      {
      GearRatios[1] = Gear4;
      }
      if (mgears == 5)
      {
      GearRatios[1] = Gear5;
      }
      if (mgears == 6)
      {
      GearRatios[1] = Gear6;
      }
      if (mgears < 1)
      {
      mgears = 1;
      }
      if (mgears > 6)
      {
      mgears = 6;
      }
    
    }
    
    defaultproperties
    {
         GearRatios(0)=-0.500000
         GearRatios(1)=10
         FWheelScale=1.250000
         RWheelScale=1.250000
         WheelPenScale=1.400000
         WheelSuspensionTravel=20.000000
         WheelSuspensionOffset=-8.000000
         WheelSuspensionMaxRenderTravel=20.000000
         MinBrakeFriction=10.000000
         MaxSteerAngleCurve=(Points=((OutVal=25.000000),(InVal=1500.000000,OutVal=8.000000),(InVal=1000000000.000000,OutVal=8.000000)))
         TorqueCurve=(Points=((OutVal=18.000000),(InVal=800.000000,OutVal=20.000000),(InVal=3000.000000,OutVal=22.000000),(InVal=5000.000000)))
         TransRatio=0.300000
         ChangeUpPoint=4000.000000
         ChangeDownPoint=2000.000000
         LSDFactor=0.500000
         EngineBrakeFactor=0.001000
         EngineBrakeRPMScale=0.010000
         MaxBrakeTorque=30.000000
         HandbrakeThresh=400.000000
         EngineInertia=0.080000
         IdleRPM=750.000000
         EngineRPMSoundRange=11000.000000
         DaredevilThreshInAirSpin=360.000000
         DaredevilThreshInAirTime=3.000000
         DaredevilThreshInAirDistance=100.000000
         Begin Object Class=SVehicleWheel Name=RRWheel
             bPoweredWheel=True
             bHandbrakeWheel=True
             BoneName="tire02"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=7.000000)
             WheelRadius=24.000000
             WheelInertia=0.200000
             SupportBoneName="RrearStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(0)=SVehicleWheel'ScorpionTurbo.TurboScorpion.RRWheel'
    
         Begin Object Class=SVehicleWheel Name=LRWheel
             bPoweredWheel=True
             bHandbrakeWheel=True
             BoneName="tire04"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=-7.000000)
             WheelRadius=24.000000
             WheelInertia=0.200000
             SupportBoneName="LrearStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(1)=SVehicleWheel'ScorpionTurbo.TurboScorpion.LRWheel'
    
         Begin Object Class=SVehicleWheel Name=RFWheel
             bPoweredWheel=True
             SteerType=VST_Steered
             BoneName="tire"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=7.000000)
             WheelRadius=24.000000
             WheelInertia=0.100000
             SupportBoneName="RFrontStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(2)=SVehicleWheel'ScorpionTurbo.TurboScorpion.RFWheel'
    
         Begin Object Class=SVehicleWheel Name=LFWheel
             bPoweredWheel=True
             SteerType=VST_Steered
             BoneName="tire03"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=-7.000000)
             WheelRadius=24.000000
             WheelInertia=0.100000
             SupportBoneName="LfrontStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(3)=SVehicleWheel'ScorpionTurbo.TurboScorpion.LFWheel'
    
         TPCamDistance=275.000000
         VehiclePositionString="in a Scorpion V12"
         VehicleNameString="Scorpion V12"
         MaxDesireability=0.600000
         WaterDamage=75.000000
         GroundSpeed=10000.000000
         HealthMax=1000.000000
         Health=1000
         Begin Object Class=KarmaParamsRBFull Name=KParams0
             KInertiaTensor(0)=1.000000
             KInertiaTensor(3)=3.000000
             KInertiaTensor(5)=3.000000
             KCOMOffset=(X=-0.250000,Z=-0.800000)
             KLinearDamping=0.050000
             KAngularDamping=0.050000
             KStartEnabled=True
             bKNonSphericalInertia=True
             KMaxSpeed=10000.000000
             bHighDetailOnly=False
             bClientOnly=False
             bKDoubleTickRate=True
             bDestroyOnWorldPenetrate=True
             bDoSafetime=True
             KFriction=0.500000
             KImpactThreshold=700.000000
         End Object
         KParams=KarmaParamsRBFull'ScorpionTurbo.TurboScorpion.KParams0'
         numforwardgears=1
         gear1=0.45
         gear2=0.65
         gear3=0.85
         gear4=1.15
         gear5=1.35
         gear6=1.65
    }

    Leave a comment:


  • replied
    My ways kinda hackjob way and AquaticSheep seems to know more about it so try his :S

    Leave a comment:


  • replied
    where are you calling g1() and g2() from?
    if you want to call them from the console you need exec

    eg

    exec function g1()
    {
    GearRatios[1] = Gear1;
    }

    also you might want to change g1() and g2() to PrevWeapon() NextWeapon(), so you can use the mouse wheel to change gears =D

    also also, why not use TorqueCurve instead of GearRatio[i]

    also also also, i should go to bed

    Leave a comment:


  • replied
    What if you had it like:
    GearRatios(0)=-0.50
    GearRatios(1)=<Gear1>
    GearRatios(2)=<Gear1>
    GearRatios(3)=<Gear1>
    GearRatios(4)=<Gear1>

    then when it needs to gear up
    change the next gear:
    GearRatios(2)=<Gear2>

    And above ones:
    GearRatios(3)=<Gear2>
    GearRatios(4)=<Gear2>

    Then maybe tell it to update and see the ratio changes and so on.

    Leave a comment:


  • replied
    I've never messed with the Physics of the vehicles, but i would love this!

    Leave a comment:


  • started a topic Help with manual transmission

    Help with manual transmission

    Im trying to get a manual transsmission to work in ut2k4 but there is a problem. It wont shift gears and it falls through the floor
    Code:
    //-----------------------------------------------------------
    // Faster Improved Scorpion by Smart_N00b
    //-----------------------------------------------------------
    class TurboScorpion extends ONSRV;
    
    var() float FWheelScale;
    var() float RWheelScale;
    var() float Gear1;
    var() float Gear2;
    
    
    simulated function PostNetBeginPlay()
    {
    
    	WheelsScale = WheelsScale * FWheelScale;
    	WheelsScale = WheelsScale * RWheelScale;
    	SetBoneScale(0, RWheelScale, Wheels[0].BoneName);
    	SetBoneScale(1, RWheelScale, Wheels[1].BoneName);
    	SetBoneScale(2, FWheelScale, Wheels[2].BoneName);
    	SetBoneScale(3, FWheelScale, Wheels[3].BoneName);
    	Wheels[0].WheelRadius = Wheels[0].WheelRadius * RWheelScale;
    	Wheels[1].WheelRadius = Wheels[1].WheelRadius * RWheelScale;
    	Wheels[2].WheelRadius = Wheels[2].WheelRadius * FWheelScale;
    	Wheels[3].WheelRadius = Wheels[3].WheelRadius * FWheelScale;
    
    	SetBoneScale(4, 1.2, 'CarLSlider');
    	SetBoneScale(5, 1.2, 'CarRSlider');
    
    	Super.PostNetBeginPlay();
    
    }
    
    function g1()
    {
      GearRatios[1] = Gear1;
    }
    
    //Enhanced steering
    simulated function KApplyForce(out vector Force, out vector Torque)
    {
    	local KRigidBodyState rbState;
    	local Vector X,Y,Z;
    
    	super.KApplyForce(Force, Torque);
    
    	GetAxes(Rotation, X,Y,Z);
    	KGetRigidBodyState(rbState);
    
            if (((Steering > 0) && (rbState.AngVel.Z > 0.5))
    	|| ((Steering < 0) && (rbState.AngVel.Z < 0.5)))
    		Torque.Z = (rbState.AngVel.Z * -1) * (80 * abs(rbState.AngVel.Z));
    
    }
    
    
    
    function g2()
    {
      GearRatios[1] = Gear2;
    }
    
    defaultproperties
    {
         GearRatios(0)=-0.500000
         GearRatios(1)=0
         FWheelScale=1.250000
         RWheelScale=1.250000
         WheelPenScale=1.400000
         WheelSuspensionTravel=20.000000
         WheelSuspensionOffset=-8.000000
         WheelSuspensionMaxRenderTravel=20.000000
         MinBrakeFriction=10.000000
         MaxSteerAngleCurve=(Points=((OutVal=25.000000),(InVal=1500.000000,OutVal=8.000000),(InVal=1000000000.000000,OutVal=8.000000)))
         TorqueCurve=(Points=((OutVal=18.000000),(InVal=800.000000,OutVal=20.000000),(InVal=3000.000000,OutVal=22.000000),(InVal=5000.000000)))
         TransRatio=0.300000
         ChangeUpPoint=4000.000000
         ChangeDownPoint=2000.000000
         LSDFactor=0.500000
         EngineBrakeFactor=0.001000
         EngineBrakeRPMScale=0.010000
         MaxBrakeTorque=30.000000
         HandbrakeThresh=400.000000
         EngineInertia=0.080000
         IdleRPM=750.000000
         EngineRPMSoundRange=11000.000000
         DaredevilThreshInAirSpin=360.000000
         DaredevilThreshInAirTime=3.000000
         DaredevilThreshInAirDistance=100.000000
         Begin Object Class=SVehicleWheel Name=RRWheel
             bPoweredWheel=True
             bHandbrakeWheel=True
             BoneName="tire02"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=7.000000)
             WheelRadius=24.000000
             WheelInertia=0.200000
             SupportBoneName="RrearStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(0)=SVehicleWheel'ScorpionTurbo.TurboScorpion.RRWheel'
    
         Begin Object Class=SVehicleWheel Name=LRWheel
             bPoweredWheel=True
             bHandbrakeWheel=True
             BoneName="tire04"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=-7.000000)
             WheelRadius=24.000000
             WheelInertia=0.200000
             SupportBoneName="LrearStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(1)=SVehicleWheel'ScorpionTurbo.TurboScorpion.LRWheel'
    
         Begin Object Class=SVehicleWheel Name=RFWheel
             bPoweredWheel=True
             SteerType=VST_Steered
             BoneName="tire"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=7.000000)
             WheelRadius=24.000000
             WheelInertia=0.100000
             SupportBoneName="RFrontStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(2)=SVehicleWheel'ScorpionTurbo.TurboScorpion.RFWheel'
    
         Begin Object Class=SVehicleWheel Name=LFWheel
             bPoweredWheel=True
             SteerType=VST_Steered
             BoneName="tire03"
             BoneRollAxis=AXIS_Y
             BoneOffset=(Y=-7.000000)
             WheelRadius=24.000000
             WheelInertia=0.100000
             SupportBoneName="LfrontStrut"
             SupportBoneAxis=AXIS_X
         End Object
         Wheels(3)=SVehicleWheel'ScorpionTurbo.TurboScorpion.LFWheel'
    
         TPCamDistance=275.000000
         VehiclePositionString="in a Scorpion V12"
         VehicleNameString="Scorpion V12"
         MaxDesireability=0.600000
         WaterDamage=75.000000
         GroundSpeed=10000.000000
         HealthMax=1000.000000
         Health=1000
         Begin Object Class=KarmaParamsRBFull Name=KParams0
             KInertiaTensor(0)=1.000000
             KInertiaTensor(3)=3.000000
             KInertiaTensor(5)=3.000000
             KCOMOffset=(X=-0.250000,Z=-0.800000)
             KLinearDamping=0.050000
             KAngularDamping=0.050000
             KStartEnabled=True
             bKNonSphericalInertia=True
             KMaxSpeed=10000.000000
             bHighDetailOnly=False
             bClientOnly=False
             bKDoubleTickRate=True
             bDestroyOnWorldPenetrate=True
             bDoSafetime=True
             KFriction=0.500000
             KImpactThreshold=700.000000
         End Object
         KParams=KarmaParamsRBFull'ScorpionTurbo.TurboScorpion.KParams0'
         numforwardgears=1
         gear1=0.4
         gear2=1.1
    
    }
Working...
X