Need help finding documentation on Vehicles in UT2004

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

OC-NightHawk

New Member
Sep 14, 2004
37
0
0
Does anybody know of some good sites to read up on how vehicles work in UT2004?

I've found the vtm's at 3dbuzz useful to get me started but I have yet to find anything about vehicles there. I have figured out how to bring in static meshes but I'm fairly certain that as a static Mesh my cars will never be able to be driven. Then I found the movers object type but it turns out thats for things like elevators and other things on predetermined paths.

Does anybody know where I can find some documentation on how to create a vehicle with UT2004? Please help a noob help himself. :)
 

meowcat

take a chance
Jun 7, 2001
803
3
18
The two best sites for reference materials are the UnrealWiki and the UDN (unreal developer network). When you need info check those first. The next best place is to search this forum and the coding forum over at atari. I say search because many a question has already been answered here if you just take a quick look.

Here is a link to the sVehicle reference documents on the UDN: http://udn.epicgames.com/Two/SVehicleReference

Also check out the tutorials over at psyonix: http://www.psyonix.com/onslaught.html
 
Last edited:

OC-NightHawk

New Member
Sep 14, 2004
37
0
0
Ironicly in the end I opened up the scripts of Epic's wheeled vehicles vehicles and figured out the jist of loading the mesh. So I have the basic script for precacheing the materials and updating them done, and I've assigned the script the animation mesh. However I'm having problems setting the karma default properties of the script. Every time I select KarmaParamsRBFull from the combo box and click new the editor crashes. Do I need to first create the karma elsewhere and then assign it to that slot?
 

meowcat

take a chance
Jun 7, 2001
803
3
18
OC-NightHawk said:
.........However I'm having problems setting the karma default properties of the script. Every time I select KarmaParamsRBFull from the combo box and click new the editor crashes. Do I need to first create the karma elsewhere and then assign it to that slot?
Uh oh! don't use the editor for script editing, it is horrible. You will need a couple things to get started. I don't know whether or not you've checked this out yet, but go here to get info on the proper scripting setup: http://wiki.beyondunreal.com/wiki/Setting_Up_UnrealScript

You will actually just edit the karma params in the default properties of the script source (the .uc file) in a text editor, then compile it (without using UED). Also your vehicles will be easier to add if you make the model a skeletal mesh (then you can use the epic code as a base). It uses a skeletal system to determine how to rotate the wheels of the model (as opposed to using separate actors for each wheel) and is much more efficient than the older KCar using static meshes.
 

OC-NightHawk

New Member
Sep 14, 2004
37
0
0
Ok, so now that I've got the script with the default properties created out side of U2004 Editor how do I get the .uc file into U2004 Editor so i can use it?

Edit: Never mind I figured it out. However while testing to see if it does indeed work I've found it doesn't. The vehicle doesn't appear.

Here's my script. Any ideas whats wrong aside from the tweaking of the physics values to get it to handle correctly.

Code:
//=============================================================================
// Places a drivable 350Z Racing Body style vehicle on the screen
//=============================================================================
class Racing350Z extends ONSWheeledCraft;

#exec OBJ LOAD FILE=..\Animations\InnerCity_Vehicles.ukx
#exec OBJ LOAD FILE=..\Sounds\ONSVehicleSounds-S.uax
#exec OBJ LOAD FILE=..\textures\VehicleFX.utx
#exec OBJ LOAD FILE=..\textures\EpicParticles.utx
#exec OBJ LOAD FILE=..\textures\InnerCityTx.utx

static function StaticPrecache(LevelInfo L)
{
    Super.StaticPrecache(L);
    //For precacheing the meshes for the destroyed vehicle, on to do list
    //L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.RVexploded.RVgun');
    //For the Textures and shaders
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZHeadlightsFinal');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZFinal');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZBody');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZBodyReflective');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZEnv');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapFinal');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapShader');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapEnvMap');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapCubeMap');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity1');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity2');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity3');
    L.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity4');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Racing350ZHeadlights');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Racing350Z');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Brake_Color');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Coil');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Firestone');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.HubCapColor');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.LightBulbGlass');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.NissanLogo');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Rotor_Color');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Tin');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.tire2');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Tread');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.Window');
    L.AddPrecacheMaterial(Material'InnerCityTx.Cars.zbottom');
}

simulated function UpdatePrecacheStaticMeshes()
{
    //For precacheing the meshes for the destroyed vehicle, on to do list
    //Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.RVexploded.RVgun');

    Super.UpdatePrecacheStaticMeshes();
}

simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZHeadlightsFinal');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZFinal');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZBody');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZBodyReflective');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.Racing350ZEnv');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapFinal');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapShader');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapEnvMap');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.HubCapCubeMap');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity1');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity2');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity3');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Shaders.InnerCity4');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Racing350ZHeadLights');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Racing350Z');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Brake_Color');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Coil');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Firestone');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.HubCapColor');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.NissanLogo');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Rotor_Color');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Tin');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.tire2');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Tread');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.Window');
    Level.AddPrecacheMaterial(Material'InnerCityTx.Cars.zbottom');
    Super.UpdatePrecacheMaterials();
}

defaultproperties
{
 WheelSoftness=0.025000
 WheelPenScale=1.200000
 WheelPenOffset=0.010000
 WheelRestitution=0.100000
 WheelInertia=0.100000
 WheelLongFrictionFunc=(Points=(,(InVal=100.000000,OutVal=1.000000),(InVal=200.000000,OutVal=0.900000),(InVal=10000000000.000000,OutVal=0.900000)))
 WheelLongSlip=0.001000
 WheelLatSlipFunc=(Points=(,(InVal=30.000000,OutVal=0.009000),(InVal=45.000000),(InVal=10000000000.000000)))
 WheelLongFrictionScale=1.100000
 WheelLatFrictionScale=1.350000
 WheelHandbrakeSlip=0.010000
 WheelHandbrakeFriction=0.100000
 WheelSuspensionTravel=15.000000
 WheelSuspensionMaxRenderTravel=15.000000
 FTScale=0.030000
 ChassisTorqueScale=0.400000
 MinBrakeFriction=4.000000
 MaxSteerAngleCurve=(Points=((OutVal=25.000000),(InVal=1500.000000,OutVal=11.000000),(InVal=1000000000.000000,OutVal=11.000000)))
 TorqueCurve=(Points=((OutVal=9.000000),(InVal=200.000000,OutVal=10.000000),(InVal=1500.000000,OutVal=11.000000),(InVal=2800.000000)))
 GearRatios(0)=-0.500000
 GearRatios(1)=0.400000
 GearRatios(2)=0.650000
 GearRatios(3)=0.850000
 GearRatios(4)=1.100000
 TransRatio=0.150000
 ChangeUpPoint=2000.000000
 ChangeDownPoint=1000.000000
 LSDFactor=1.000000
 EngineBrakeFactor=0.000100
 EngineBrakeRPMScale=0.100000
 MaxBrakeTorque=20.000000
 SteerSpeed=160.000000
 TurnDamping=35.000000
 StopThreshold=100.000000
 HandbrakeThresh=200.000000
 EngineInertia=0.100000
 IdleRPM=500.000000
 EngineRPMSoundRange=9000.000000
 bDrawDriverInTP=True
 bDrawMeshInFP=false
 bHasHandbrake=True
 VehiclePositionString="in a 350Z GTS-R"
 VehicleNameString="350Z GTS-R"
 MaxDesireability=0.400000
 ObjectiveGetOutDist=1500.000000
 HornSounds(0)=Sound'ONSVehicleSounds-S.Horns.Horn06'
 HornSounds(1)=Sound'ONSVehicleSounds-S.Horns.Dixie_Horn'
 GroundSpeed=1000.000000
 HealthMax=300.000000
 Health=300
 Mesh=SkeletalMesh'InnerCity_Vehicles.Racing350Z'
 SoundVolume=180
 CollisionRadius=100.000000
 CollisionHeight=40.000000
 Begin Object Class=KarmaParamsRBFull Name=KParams0
         KInertiaTensor(0)=1.000000
         KInertiaTensor(3)=3.000000
         KInertiaTensor(5)=3.000000
         KCOMOffset=(X=-0.250000,Z=-0.400000)
         KLinearDamping=0.050000
         KAngularDamping=0.050000
         KStartEnabled=True
         bKNonSphericalInertia=True
         bHighDetailOnly=False
         bClientOnly=False
         bKDoubleTickRate=True
         bDestroyOnWorldPenetrate=True
         bDoSafetime=True
         KFriction=0.500000
         KImpactThreshold=700.000000
 End Object
 KParams=KarmaParamsRBFull'Onslaught.ONS350Z.KParams0'
}
 
Last edited:

chip

New Member
Nov 14, 2002
524
0
0
Visit site
meowcat said:
Uh oh! don't use the editor for script editing, it is horrible.
...snip...
just edit the karma params in the default properties of the script source (the .uc file) in a text editor, then compile it (without using UED).
you should be able to access the defaultproperties for a new class in UEd using the editdefault class=<classname> command line. i do a lot of myLevel scripting in UEd this way, haven't met any real probs yet.

but for out of editor coding, look into using the UDE utility that ships with UT2004 -- it really is sweet imo.
 

OC-NightHawk

New Member
Sep 14, 2004
37
0
0
Well I got the vehicle to display using vdm_ai_package. Except I can't actually get in the car and drive it.

However i was looking through the SVehicle properties and noticed the wheel tree branch property. Should I make 4 of them and give it the name of the bone for the wheels?

http://studentpages.scad.edu/~ejackm20/images/Racing350ZHighRes.png
I don't know if its just me but the mesh seems to shade better as a animations package instead of a static mesh.

Edit: Ok, problem solved about entering the vehicle. This thread was helpful. http://forums.beyondunreal.com/showthread.php?t=140836&highlight=enter+vehicle By turning off the actor collision I was able to test where I have to be to get in the vehicle and found out its smack dab in the middle where you can't possibly walk. So I'll tweak that vector.

New problem. Once in I can't move. Do I actually have to code in the key presses?
 
Last edited:

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
A common problem, perhaps?

Attempting to get a custom vehicle ingame. Have imported it fine, set up its wheels properly and have it spawned ingame with the player inside.

However, it doesnt move at all. No engine noises, nothing. Using the same defaults as the scorpion, with changed bone names for all the important stuff. What did we miss?

edit: wait! brain leak! perhaps is it because it doesn't have a collision hull?
 
Last edited:

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
nevermind! that is exactly what the problem was.

It turns out you create collision directly in the animation browser through the menus on the right hand side - basically you make boxes and spheres and parent them to bones.

However the onslaught vehicles all seem to have both collision boxes (giant ones that encompass the whole vehicle) and staticMesh collision hulls. Are both necessary? My vehicle works fine with just the box, but I was thinking maybe when a staticMesh is present the box is just used as a higher level LOD test before computing based on the mesh.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Static mesh collision is used for weapons like the goo gun, which use per poly collision (bUseCollisionStaticMesh=true in the default properties for BioGlob).
 
Last edited:

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
you can make multiple boxes for a more accurate shape, right? Like say for a standard sedan looking thing you might have smaller boxes for the front and back areas and a taller one in the middle for the whole cabin area.

Just wondering whether that's a good idea or it would cause things to get stuck or jammed in the concave places. It's wierd that the default vehicles all have this really rough box around them. But then again, most of the UT vehicles are pretty boxy in shape aren't they.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
@rich_zap: for some weapons (goo gun, ONSMines, ONSgrenades) the collision static mesh is used for more accurate placing of the "sticky" projectile, I suppose its not really neccessary, but it does look better when using them.

@popsi: I tried using multiple boxes for a few of my own vehicles with mixed results. When using multiple boxes, I would recommend using a single box (or maybe two) for the karma collision (turn off the other collision properties of the box), and no more than 4 or 5 boxes set to block zero extent and non-zero extent traces for the weapon fire and player collision (turn off karma collision for these). If you have too many karma boxes then the vehicle really can get stuck on things a lot easier and if you have to many collision boxes (and too many copies of the vehicle) the collision takes a lot longer to calculate.