PDA

View Full Version : Vehicles



Temporal_Mechanic
11-12-2009, 09:50 AM
Hi,

I'm an experienced programmer but new to the unreal engine. I'm trying to make a simple space game by adding my own vehicle into the udk. I followed the instructions here:

http://udn.epicgames.com/Three/SettingUpVehicles.html#Setting%20Up%20Vehicles

and I have a vehicle available in the actor's browser under pawn|vehicle|SVehicle|myVehicle. So far so good. When I add this into a test map and run the map it hangs in the air until I shoot it. When shot it falls to the ground, bounces a little and comes to rest. That seems to be all I can do with it. It isn't possible to enter or use the vehicle. I assume this is because there is no code to do so. Following this tack I decided to try changing the .uc file to extend either the Circada or the AirVehicle class. When I do this I can no longer find the vehicle in the actor browser, either under SVehicle or vehicleFactory.

The question is, what do I need to do to get a working, useable vehicle? Are there any good tutorials? I've had a look, but so far Google has failed me.

Thanks.

Showster
11-12-2009, 10:23 AM
http://sites.google.com/site/ut40kmod/ has some tutorials for ut3, I guess you can try and adapt it for UDK.

One of the reasons that vehicles don't play nice sometimes is physics meshes, but as to why yours doesn't work it could be one of many things. The best thing to do is to share your source / post up piccies of what you've done so far :)

MagnumAI
11-12-2009, 05:03 PM
I am running into the same issue, but for me my material is not showing unless I shoot the vehicle then you can slightly see the texture on the vehicle.

Steve Polge
11-12-2009, 06:16 PM
UTVehicles are not placeable, because they are spawned using a UTVehicleFactory. You need to add the placeable keyword to your class definition, since cicada is not placeable, e.g. "class myvehicle extends UTVehicle_Cicada placeable;"

MagnumAI
11-12-2009, 06:51 PM
UTVehicles are not placeable, because they are spawned using a UTVehicleFactory. You need to add the placeable keyword to your class definition, since cicada is not placeable, e.g. "class myvehicle extends UTVehicle_Cicada placeable;"


So is the tutorial linked by the OP incorrect?

dr3k
11-13-2009, 04:48 AM
i just found this tutorial (video) seems like it's for ut3 but with some workarounds we maybe can get the same results!

if someone know how to apply this to udk, we need your help!
http://www.videojug.com/webvideo/how-to-add-vehicles-in-unreal-editor

MagnumAI
11-13-2009, 08:48 AM
That video just shows the basic menu commands for existing vehicles.

What I was referring to on the OP tutorial, is if you add a car using UTVehicle Factory, then I am guessing the skeletal structure must be the same as the vehicle you are adding yours as.


I will try later to re-rig my vehicle based on the Scorpion bones and see what happens.

I would love to see Epic release the source model files for perhaps the Scorpion. That to me is the quickest way to learn what is needed.

Temporal_Mechanic
11-13-2009, 11:49 AM
Ok, progress is, er, progressing.

Showster: That link helped a lot, thanks.
MagnumAI: I had the same material problem, it still isn't working properly, but I figured I'd sort one thing at once. The link in my first post is helpful for getting the assets into the editor and set up but I couldn't get the scripts to work that way.
Steve Polge: Thanks, I was assuming that a vehicle factory would be created by magic if I created a new vehicle. I'm not sure if I want them placeable or created from a factory yet.
dr3k: Thanks for the link, it shows how to place a vehicle factory in a level for existing vehicles, but the same procedure seems to apply with a custom vehicle factory.

Where I am now: I have a working vehicle that behaves like a cicada but has my own mesh. I did this by copying the .uc files for cicada, cicada_content and cicada_factory. I then re-named both the files and the classes to correspond to my vehicle. The last task was to change any references in those files to my own assets. One thing I found unhelpful in the UT40K tutorial was that the code listing didn't have a list of changes so this is what I changed.


UTFury.uc:

line 5
"native(Vehicle)" deleted

lines 8-12
"cpptext
{
virtual void TickSpecial(FLOAT DeltaTime);
virtual UBOOL HasRelevantDriver();
}" deleted


UTFury_content.uc

line 15
"JetControl = UTSkelControl_JetThruster(Mesh.FindSkelControl('Ci cadaJet'));"
becomes
"JetControl = UTSkelControl_JetThruster(Mesh.FindSkelControl('B5 FuryControl'));"

lines 45-48
"SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cic ada'
AnimTreeTemplate=AnimTree'VH_Cicada.Anims.AT_VH_Ci cada'
PhysicsAsset=PhysicsAsset'VH_Cicada.Mesh.SK_VH_Cic ada_Physics'
AnimSets.Add(AnimSet'VH_Cicada.Anims.VH_Cicada_Ani ms')"
becomes
" SkeletalMesh=SkeletalMesh'B5Mod.B5Meshes.UTFury'
AnimTreeTemplate=AnimTree'B5Mod.B5Anims.UTFuryAnim Tree'
PhysicsAsset=PhysicsAsset'B5Mod.B5Meshes.UTFury_Ph ysics'
AnimSets.Add(AnimSet'B5Mod.B5Anims.UTFuryAnimSet')"


UTVehicleFactory_Fury.uc:

line 9:
"SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cic ada'"
becomes
"SkeletalMesh=SkeletalMesh'B5Mod.B5Meshes.UTFury'"

line 21:
"VehicleClassPath="UTGameContent.UTVehicle_Cicada_Content""
becomes
"VehicleClassPath="B5SFMod.UTFury_Content""

And that did the trick. The mesh is upside down and at about 30 degrees to horizontal, but I think thats an issue with my model. The material now shows up under lights, but is the cicada material, and obviously doesn't fit the mesh. I haven't reset the material in any of the .uc files so I imagine that is the problem there. I'll keep you all updated with progress as things move along. Thanks for the replys.

geodav
11-13-2009, 02:44 PM
sorry i couldn't list every chage you need to make in the code, for the materials you'll have to create all the nessesary materials including the team,burnout, and all the others, then change them via your code, i've not tried a vehicle in UDK yet.

ps. if you need help then just shout
pps used to watch B5 all the time ;)

Temporal_Mechanic
11-14-2009, 10:08 AM
I appreciate that you took the time to write the tutorial at all, I wouldn't have got nearly this far without it, thanks.

Temporal_Mechanic
11-15-2009, 08:17 AM
So, I have my shiny new vehicle, I can load it into a level and it behaves more or less the way I would expect. The problem I have at the moment is that the camera doesn't follow the vehicle properly. The camera stays near the world origin. It moves in the same direction as the vehicle, but much, much slower. I would guess that this is caused by a scale property of some description, but I have no idea which one. My attempts to find this property in the code has so far failed, does anyone know what I need to change to fix this?

Edit: My mistake, turns out I made a typo in the socket set-up so the code couldn't find the camera socket, problem solved.

Dezky
11-29-2009, 01:27 PM
I have exactly the same problem !

I'm not so experienced in unreal script, and i don't find where is the camera socket in all of the parameters of the seat... could you give me what have you modify to correct this problem ?

Edit : Ok i have found a tutorial who talk about socket :) sorry for the up !

sdinesh86
01-06-2010, 02:17 AM
hey for the camera socket, u need to open your skeletal mesh for vehicle, then in Mesh on toolbar the last option in socket manager, here u can create a new socket for your camera and use that in the script and your problem is solved