Home Unreal Engine

Vehicle has forward and reverse, ......reversed?

polycounter lvl 8
Offline / Send Message
gannonroader polycounter lvl 8
in a nutshell, I made a new vehicle, rigged it, blah blah blah, got it in udk, and adjusted someone elses script to accompany my vehicle (it has 8 tires). Everything is working great, except that the W key is reverse, and S is forward. I thought maybe the model was facing the wrong way on the x axis, so I made a new save, and flipped the model, and then rotated my bones, and re-applied my skin modifier (from scratch), but the vehicle is still driving in the wrong direction! I tried rotating the camera socket as well, but I have a feeling i'm missing something easy here. Any ideas how to fix this?


EDIT: Added the code as it's probably useful

// lets extend SVehicle and make our own custom vehicle class

class LAVIII extends SVehicle;

var() name CameraTag; //declare variable for camera attach point

//code section for camera
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector SocketLoc;
local rotator SocketRot;
local rotator Rot;

//get the location and rotation of the socket
Mesh.GetSocketWorldLocationAndRotation(CameraTag, SocketLoc, SocketRot);

// combine orientaton of socket with the mouse orientation
Rot.Yaw = SocketRot.Yaw + Controller.Rotation.Yaw;
Rot.Roll = SocketRot.Roll;
Rot.Pitch = SocketRot.Pitch + Controller.Rotation.Pitch;

// output transforms
out_CamLoc = SocketLoc;
out_CamRot = Rot;

return true;
}

defaultproperties
{
CameraTag=Camera // assign the socket to the camera code
COMOffset=(x=0.0,y=-10.0,z=-36.0) // center of gravity offset from root_bone local

// parameters for player to flip vehicle
UprightLiftStrength=280.0
UprightTime=1.25
UprightTorqueStrength=500.0
bCanFlip=true

bHasHandbrake=true
GroundSpeed=1500 // max speed on ground
AirSpeed=1700 // max speed in air
HeavySuspensionShiftPercent=0.75f;

// define the vehicle simulation
Begin Object Class=UDKVehicleSimCar Name=SimObject

WheelSuspensionStiffness=80.0 //how soft the suspension is
WheelSuspensionDamping=3.0
WheelSuspensionBias=0.1
ChassisTorqueScale=0.0
MaxBrakeTorque=5.0
StopThreshold=100

MaxSteerAngleCurve=(Points=((InVal=0,OutVal=45),(InVal=600.0,OutVal=15.0),(InVal=1100.0,OutVal=10.0),(InVal=1300.0,OutVal=6.0),(InVal=1600.0,OutVal=1.0)))
SteerSpeed=110

LSDFactor=0.0

// The follow two parameters set the gear rangers (in rpm) and the torque produced per range
TorqueVSpeedCurve=(Points=((InVal=-600.0,OutVal=0.0),(InVal=-300.0,OutVal=80.0),(InVal=0.0,OutVal=130.0),(InVal=950.0,OutVal=130.0),(InVal=1050.0,OutVal=10.0),(InVal=1150.0,OutVal=0.0)))
EngineRPMCurve=(Points=((InVal=-500.0,OutVal=2500.0),(InVal=0.0,OutVal=500.0),(InVal=549.0,OutVal=3500.0),(InVal=550.0,OutVal=1000.0),(InVal=849.0,OutVal=4500.0),(InVal=850.0,OutVal=1500.0),(InVal=1100.0,OutVal=5000.0)))

EngineBrakeFactor=0.025
ThrottleSpeed=0.2
WheelInertia=0.2
NumWheelsForFullSteering=4
SteeringReductionFactor=0.0
SteeringReductionMinSpeed=1100.0
SteeringReductionSpeed=1200.0
bAutoHandbrake=true
bClampedFrictionModel=true
FrontalCollisionGripFactor=0.18
ConsoleHardTurnGripFactor=1.0
HardTurnMotorTorque=0.7

SpeedBasedTurnDamping=20.0
AirControlTurnTorque=40.0
InAirUprightMaxTorque=15.0
InAirUprightTorqueFactor=-30.0

// Longitudinal tire model based on 10% slip ratio peak
WheelLongAsymptoteSlip=2.0
WheelLongAsymptoteValue=0.6

// Lateral tire model based on slip angle (radians)
WheelLatExtremumSlip=0.35 // 20 degrees
WheelLatExtremumValue=0.9
WheelLatAsymptoteSlip=1.4 // 80 degrees
WheelLatAsymptoteValue=0.9

bAutoDrive=false
AutoDriveSteer=0.3
End Object

SimObj=SimObject
Components.Add(SimObject)

// define the vehicle mesh, animation tree, and physics asset
Begin Object Name=SVehicleMesh
SkeletalMesh=SkeletalMesh'LAVIII.LAVIIIRIG'
AnimTreeTemplate=AnimTree'LAVIII.AT_LAVIII'
PhysicsAsset=PhysicsAsset'LAVIII.LAVIIIRIG_Physics'
End Object

// define all the wheels
Begin Object Class=SVehicleWheel Name=FRWheel
BoneName="F_R_Tire"
SkelControlName="F_R_Tire_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(0)=FRWheel

Begin Object Class=SVehicleWheel Name=FFRWheel
BoneName="FF_R_Tire"
SkelControlName="FF_R_Tire_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(1)=FFRWheel

Begin Object Class=SVehicleWheel Name=FLWheel
BoneName="F_L_Tire"
SkelControlName="F_L_Tire_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(2)=FLWheel

Begin Object Class=SVehicleWheel Name=FFLWheel
BoneName="FF_L_Tire"
SkelControlName="FF_L_Tire_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(3)=FFLWheel

Begin Object Class=SVehicleWheel Name=RRWheel
BoneName="R_R_Tire"
SkelControlName="R_R_Tire_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(4)=RRWheel

Begin Object Class=SVehicleWheel Name=RRRWheel
BoneName="RR_R_Tire"
SkelControlName="RR_R_Tire_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(5)=RRRWheel

Begin Object Class=SVehicleWheel Name=RLWheel
BoneName="R_L_Tire"
SkelControlName="R_L_Tire_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(6)=RLWheel

Begin Object Class=SVehicleWheel Name=RRLWheel
BoneName="RR_L_Tire"
SkelControlName="RR_L_Tire_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(7)=RRLWheel

}

Replies

  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    check the orientation of the wheel bones.

    Try flipping their y axis and re-exporting. (assuming x forward z up.)
  • gannonroader
    Offline / Send Message
    gannonroader polycounter lvl 8
    You could be right, is there an eay way to fix this?
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    .. yes.

    Rotate the wheel bones 180 degrees on the up axis, rebind and re-export.
  • gannonroader
    Offline / Send Message
    gannonroader polycounter lvl 8
    When I say easy, I meant as in a one minute fix, and you're talking to someone who has never rigged a vehicle until a couple days ago. This is brand new to me, so don't assume that what's easy for you is easy for me hahahaha.
  • gannonroader
    Offline / Send Message
    gannonroader polycounter lvl 8
    Vailias wrote: »
    .. yes.

    Rotate the wheel bones 180 degrees on the up axis, rebind and re-export.


    Ok, I did this, and it didn't seem to have any effect at all, but i'm wondering if maybe I skipped a step. What I did was copy'd the skin modifier to the clipboard, and then deleted it. Rotated the bones, and then applied the skin modifier back to the vehicle, and exported, and then reimported to udk. I rotated the bones in all kinds of different directions and it didn't seem to have any effect on which way my lav drives.
  • gannonroader
    Offline / Send Message
    gannonroader polycounter lvl 8
    Yeah, this had no effect at all as far as I can tell unless I did something wrong
  • gannonroader
    Offline / Send Message
    gannonroader polycounter lvl 8
    Actually, it did have an effect. The tires are now rotating around the root bone instead of their own bones. My hair is seriously turning gray on this. It's for a portfolio, and I don't want to pass it in with the controls reversed, but any attempt i've made to fix it has completely destroyed it.
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    odd. IF they're rotating around the root bone, it sounds like they didn't get re-weighted properly, OR your bone names for your powered wheels don't match the ones in your rig.

    You could upload it and post a link here for it to be looked over if you like.

    Also double check in unreal's skeletal mesh viewer/anim editor that the bone axes for the wheels have Y pointing to the vehicles right. I seem to recall having export issues once or twice that caused the problem you're having. You may need to actually alter the pivot point in your DCC software rather than just rotate the bone itself. Both max and maya have this available. Max is in the motion panel with the button "affect pivot only" and maya's I believe can be accessed by pressing the home key. Its been a while though so you may wish to double check that.
    Uvehicle.jpg
Sign In or Register to comment.