Creating vehicles in Maya and on Mac
by Jacco Jansen · 02/23/2006 (9:41 am) · 4 comments
Hi there everyone
I had a large library of vehicles in .3ds format and wanted to convert them for use with Torque but realized I had no idea where to begin. Being a Mac user I am stuck with using Maya instead of Max. Using Maya, there was only really one resource I could think of for help...
I went there, followed the instructions, had no luck, looked around for some more info, got the same info from various people and yet still no luck. Then I discovered that all the people gave me the same info and all of them were wrong! So started my quest to try and figure out how to create a Torque vehicle...
After two weeks of trial and error and running into basically every error you can get, I finally figured out how to do things and thought I'd share my knowledge with you good people.
I am including files for you to use as a basis to work from and in doing so, I am inadvertently creating a base vehicle resource for Mac users and for Maya users. Lucky!
So, without further ado, here is my hard learnt knowledge:
After flipping the normals of my 3ds shape and scaling it up by 130 I finally got myself a vehicle to work off of. And then there was a few simple steps to follow to prepare the vehicle for export.
Step 1:
Open up dtsUtility and make sure all your settings are set for use with Torque. If you have dtsUtility, I assume it is already done so let's move on...
Step 2:
If your shape is not already in the root level of the scene, using the Outliner, Middle Mouse Drag it to the root level and delete the hierarchy it was in.
Step 3:
Click on "Embed Shape". This will then create the base hierarchy needed for a torque shape to export.
Step 4:
Double click on the mesh and rename it to something ending in a digit. For example: CarMesh2. This will be your level of detail. Select the options box for the command "Edit->FreezeTransform" from the Maya menu bar and make sure to select Rotate, Transform and Scale before you commit the transform.
Then click on "Register Details" and rename the new node that gets created to include a digit at the end that matches your mesh's digit. For example, name the new node "detail2".
Note: You can create as many LOD shapes as you wish and repeat Step 4, but for this tutorial I will only be doing one LOD.
Step 5:
In the dtsUtility window menu bar, click on:
DTS->Utility nodes->eye and DTS->Utility nodes->cam.
Then click on
DTS->Utility nodes->mount 6 times.
(Or only once and then select Edit->Duplicate 5 times)
Step 6:
Select all the nodes you just created and click on Edit->FreezeTransform for all the selected nodes.
Step 7:
Move the eye, cam and mount0 nodes to where you would like them to be.
NOTE:Eye represents your 1st person point of view, while cam represents your 3rd person point of view. Mount0 represents where your character will sit when he/she enters the vehicle.
Now rename "mount1" up to "mount4" to hub0, hib1, hib2 and hub3. Starting with your vehicle's front left wheel as from the TOP view, place the hub nodes in a clockwise direction at the locations where you want the wheels to be. This will be the center of your wheel. When done, do NOT freeze the transformations of the hub nodes! The transform information is what tells Torque where to place the wheels.
Step 8:
Click on Register Details and rename the new node "Collision-1". Maya will rename this to "Collision_1" but the Maya2DTS exporter will see this correctly. Click on Create->PolyPrimative->Cube and scale to more or less fit inside the vehicle you have created.
Rename this poly to "Col-1" and Middle Mouse Drag onto the "Start01" node to make it a child of "Star01". Hit Edit->FreezeTransform.
Step 9:
In dtsUtility, click "Create Sequence Node". Rename this node to sequence_spring0 and select Edit->Duplicate 3 times.
Step 10:
Your vehicle setup is now complete, but for it to work, you need to setup animations. Contrary to the tutorials I received online, you do NOT have to setup a "turn" animation for each wheel. You DO have to setup an animation for the UP and DOWN movement for ever wheel. Set the total frames for the file to 12. Adjust the height of all "hub" nodes to be the same. Once all hub nodes are the same height, using the outliner, timeline and keyboard (respectively), follow the following sequence of events. Click:
hub0, Frame1, S, Frame3, S, hub1, frame4, S, frame6, S, hub2, frame7, S, frame9, S, hub3, frame10, S, frame12, S, hub0, frame2, (adjust Y transform slightly), S, hub1, frame5, (adjust Y transform to the same as hub0's Y value), S, hub2, frame8, (adjust Y transform), S, hub3, frame11, (adjust Y transform), S.
Step 11:
In dtsUtility, hit "Sequence Attributes" and set the start and end frame pairs from top to bottom as:
1 and 3, 4 and 6, 7 and 9, 10 and 12.
Step 12:
Your shape is now ready and you can export it using the dtsUtility. Your shape will not export correctly, though, because the maya2dts exporter will delete all empty nodes. To fix this, create a new text file and save it in the same directory as your source file. You can either call it the same name as your source file but with the extention .cfg and inside name every node that you have just created, or you can call it dtsScene.cfg and include all nodes in there. I decided to take the easy way out and wrote only this:
Now hit export and your shape is done.
Now you need to setup the wheel. Believe it or not, this is where the real trouble begins...
Step 1:
Create the basic wheel and create a collision shape for it. I just use a cube for my collision shape since I believe the simpler the better. Very important to remember here is that the front of your wheel is NOT the tire that points to the front of your car, it is actually the hub cap. Model your wheel so the hub cap points towards you in your front view.
Step 2:
Select your wheel (or collision node, depending which one is the larger of the two, and hit "Create bounding box".
Select your shape and click "Embed shape". Now middle mouse drag the collision object onto the start01 node. As before with your vehicle, create a detail node and rename your node and mesh to have the same digit at the end. Make sure you select a number larger than 1. Remember to name your collision mesh col-1 and to create a node called collision-1 by clicking "register details" and renaming the new node.
Step 3:
Open the property inspector and select each mesh file in turn, making sure it's pivot point is in the center of the mesh. This is an absolutely CRUCIAL step. The wheel's pivot should hopefully be in the center if you created the wheel manually. If you imported it, then make sure the translate values are all 0 then set the global pivots locations to 0 as well.
The bounds shape will NOT have it's pivot at the center, but at the base. It is CRUCIAL that you set this to the center. If you do not, your vehicle will behave like a mechanical spider. Trust me, it's funny as heck but not really what you want...
Step 4:
The most important thing you could possibly do is this: Click Edit->FreezeTransform for both the wheel and the collision shape. The settings should be correct since you set it in the previous section. Now... Select the bounding box, select the options for the FreezeTransform command and DESELECT the rotate option. Now(!) apply the freeze transform to the bounding box.
That is it. You are done. Hit export shape and edit your car.cs script to use the new vehicle's body and wheel and enjoy your new vehicle. Some tweaking of the script file will still be needed to get your Ferari to NOT behave like a dune buggy, but this I leave to you to figure out...
I have included the steps needed to create the vehicle, but there were many stumbles along the way that caused me a great many headaches for a number of weeks. I am including a few of the problems I had in the hopes that this may solve some of your problems, although, if my instruction is up to scratch you should hopefully NOT have to deal with any of these problems.
For the sake of playing it safe, though:
Q: David Macisaac was helping me create a reference vehicle and when I loaded his export of my file, his wheels always started off pointing straight ahead, but mine always started off fully turned to the left as far as the vehicle was set up to turn. I couldn't figure out why.
A: Well, the wheels have a max range of turn from left to right. It seems it loads fully turned to one side and then either straightens itself out or tests it's range. My problem was that my wheel mesh got stuck in my vehicle/collision mesh and hence never got to move from that point, giving the impression that the wheels were facing a different direction from the hub rotation.
Q: In the (very) few online tutorials I could find about vehicle creation, they stated that the required nodes are mass, cam, eye, mount0 [.. mount9] and ground0 to ground3.
A: False! The nodes ground0 to ground3 are in fact NOT used, but should be replaced with hub0 to hub3 nodes.
Q: When my vehicle loads, my vehicle seems tilted and my front and rear wheels are not aligned even though I set the hight values manually and set a keyframe on them. My front/rear wheels are now stuck in the vehicle mesh.
A: In the script, the mass variable determines how far the vehicle is pushed down and kept back up again by the springs. With a high mass value, combined with weak springs, the vehicle will tilt (and here is the key) in the direction of your mass node. If you place your mass node in the center of mass (as according to you), the vehicle will tilt and get stuck in it's own wheels. By placing the mass node right in between the 4 hubs, your vehicle's weight will be distributed correctly.
Q: When I correctly modeled my vehicle, my wheels appear in different, seemingly random, locations.
A: The problem was not with the vehicle mesh, but rather with the pivot point in the bounds mesh of the wheel shape.
Q: In my game, my wheels seem to rotate around the tip of the wheel, instead of spinning in place
A: Once more, the problem lies with the pivot point of the bounding box of the wheel shape. Place it at the center of the shape and your problems are solved.
Q: After modelling my wheel to face in the right direct and placing the pivot points in the correct place, my wheel now loads turned on it's side and spins erratically.
A: This took me ages to figure out. As soon as I got everything working, it all got messed up again due to this: When I freeze transformations on the bounding box, the bounding box gets rotated. My Maya settings work with y pointing up, but Torque works with z facing up. When you click on "Create bounds", it automatically rotates the bounding box in such a way that your model appears correctly. By freezing transformations on the bounding box, you reset the rotation and that loads your model incorrectly in game. The solution: when you freeze the bounding box, click the options box and DESELECT rotation before committing the freeze transform.
That is all I have to say on this matter. I hope this is of use to some of you and wish you the best of luck.
Please note that the model I am including (for the time being that is) is a part of the DarkMatter package and as such you may not use it in your own games unless you purchase the package from [url="http://www.thegamecreators.com"]here[/url]. I will replace the model later on and remove this paragraph, but for now, please respect their copyright.
Thanks go to David Macisaac for his assistance.
You pointed me in the right direction and gave me loads of support and plenty of your time. Thanks for that. It is really appreciated.
As a final note before I sign off: to create a new vehicle, all you need do now, is import your shape, replace the current shape and collision mesh, then play with the nodes and set the keyframes for each hub node and you are done. Real simple. Your entire hierarchy is already in place for you :) Enjoy!
Now, I do have a small request to ask of you guys and gals, if you wouldn't mind...
Please help me create a free resource site for Torque users. Since not everyone is good at modeling, and content can be hard to come by, if you find this resource useful, please consider giving me your new vehicles for download from my site.
If we all share our resources for free we can all get busy making games instead of scrounging around for content. It's just a thought. No need to pay me any mind if you don't want to :D
Anyway, here it is, enjoy :D
I had a large library of vehicles in .3ds format and wanted to convert them for use with Torque but realized I had no idea where to begin. Being a Mac user I am stuck with using Maya instead of Max. Using Maya, there was only really one resource I could think of for help...
I went there, followed the instructions, had no luck, looked around for some more info, got the same info from various people and yet still no luck. Then I discovered that all the people gave me the same info and all of them were wrong! So started my quest to try and figure out how to create a Torque vehicle...
After two weeks of trial and error and running into basically every error you can get, I finally figured out how to do things and thought I'd share my knowledge with you good people.
I am including files for you to use as a basis to work from and in doing so, I am inadvertently creating a base vehicle resource for Mac users and for Maya users. Lucky!
So, without further ado, here is my hard learnt knowledge:
After flipping the normals of my 3ds shape and scaling it up by 130 I finally got myself a vehicle to work off of. And then there was a few simple steps to follow to prepare the vehicle for export.
Step 1:
Open up dtsUtility and make sure all your settings are set for use with Torque. If you have dtsUtility, I assume it is already done so let's move on...
Step 2:
If your shape is not already in the root level of the scene, using the Outliner, Middle Mouse Drag it to the root level and delete the hierarchy it was in.
Step 3:
Click on "Embed Shape". This will then create the base hierarchy needed for a torque shape to export.
Step 4:
Double click on the mesh and rename it to something ending in a digit. For example: CarMesh2. This will be your level of detail. Select the options box for the command "Edit->FreezeTransform" from the Maya menu bar and make sure to select Rotate, Transform and Scale before you commit the transform.
Then click on "Register Details" and rename the new node that gets created to include a digit at the end that matches your mesh's digit. For example, name the new node "detail2".
Note: You can create as many LOD shapes as you wish and repeat Step 4, but for this tutorial I will only be doing one LOD.
Step 5:
In the dtsUtility window menu bar, click on:
DTS->Utility nodes->eye and DTS->Utility nodes->cam.
Then click on
DTS->Utility nodes->mount 6 times.
(Or only once and then select Edit->Duplicate 5 times)
Step 6:
Select all the nodes you just created and click on Edit->FreezeTransform for all the selected nodes.
Step 7:
Move the eye, cam and mount0 nodes to where you would like them to be.
NOTE:Eye represents your 1st person point of view, while cam represents your 3rd person point of view. Mount0 represents where your character will sit when he/she enters the vehicle.
Now rename "mount1" up to "mount4" to hub0, hib1, hib2 and hub3. Starting with your vehicle's front left wheel as from the TOP view, place the hub nodes in a clockwise direction at the locations where you want the wheels to be. This will be the center of your wheel. When done, do NOT freeze the transformations of the hub nodes! The transform information is what tells Torque where to place the wheels.
Step 8:
Click on Register Details and rename the new node "Collision-1". Maya will rename this to "Collision_1" but the Maya2DTS exporter will see this correctly. Click on Create->PolyPrimative->Cube and scale to more or less fit inside the vehicle you have created.
Rename this poly to "Col-1" and Middle Mouse Drag onto the "Start01" node to make it a child of "Star01". Hit Edit->FreezeTransform.
Step 9:
In dtsUtility, click "Create Sequence Node". Rename this node to sequence_spring0 and select Edit->Duplicate 3 times.
Step 10:
Your vehicle setup is now complete, but for it to work, you need to setup animations. Contrary to the tutorials I received online, you do NOT have to setup a "turn" animation for each wheel. You DO have to setup an animation for the UP and DOWN movement for ever wheel. Set the total frames for the file to 12. Adjust the height of all "hub" nodes to be the same. Once all hub nodes are the same height, using the outliner, timeline and keyboard (respectively), follow the following sequence of events. Click:
hub0, Frame1, S, Frame3, S, hub1, frame4, S, frame6, S, hub2, frame7, S, frame9, S, hub3, frame10, S, frame12, S, hub0, frame2, (adjust Y transform slightly), S, hub1, frame5, (adjust Y transform to the same as hub0's Y value), S, hub2, frame8, (adjust Y transform), S, hub3, frame11, (adjust Y transform), S.
Step 11:
In dtsUtility, hit "Sequence Attributes" and set the start and end frame pairs from top to bottom as:
1 and 3, 4 and 6, 7 and 9, 10 and 12.
Step 12:
Your shape is now ready and you can export it using the dtsUtility. Your shape will not export correctly, though, because the maya2dts exporter will delete all empty nodes. To fix this, create a new text file and save it in the same directory as your source file. You can either call it the same name as your source file but with the extention .cfg and inside name every node that you have just created, or you can call it dtsScene.cfg and include all nodes in there. I decided to take the easy way out and wrote only this:
Quote:AlwaysExport:Easy, yes/no?
*
Now hit export and your shape is done.
Now you need to setup the wheel. Believe it or not, this is where the real trouble begins...
Step 1:
Create the basic wheel and create a collision shape for it. I just use a cube for my collision shape since I believe the simpler the better. Very important to remember here is that the front of your wheel is NOT the tire that points to the front of your car, it is actually the hub cap. Model your wheel so the hub cap points towards you in your front view.
Step 2:
Select your wheel (or collision node, depending which one is the larger of the two, and hit "Create bounding box".
Select your shape and click "Embed shape". Now middle mouse drag the collision object onto the start01 node. As before with your vehicle, create a detail node and rename your node and mesh to have the same digit at the end. Make sure you select a number larger than 1. Remember to name your collision mesh col-1 and to create a node called collision-1 by clicking "register details" and renaming the new node.
Step 3:
Open the property inspector and select each mesh file in turn, making sure it's pivot point is in the center of the mesh. This is an absolutely CRUCIAL step. The wheel's pivot should hopefully be in the center if you created the wheel manually. If you imported it, then make sure the translate values are all 0 then set the global pivots locations to 0 as well.
The bounds shape will NOT have it's pivot at the center, but at the base. It is CRUCIAL that you set this to the center. If you do not, your vehicle will behave like a mechanical spider. Trust me, it's funny as heck but not really what you want...
Step 4:
The most important thing you could possibly do is this: Click Edit->FreezeTransform for both the wheel and the collision shape. The settings should be correct since you set it in the previous section. Now... Select the bounding box, select the options for the FreezeTransform command and DESELECT the rotate option. Now(!) apply the freeze transform to the bounding box.
That is it. You are done. Hit export shape and edit your car.cs script to use the new vehicle's body and wheel and enjoy your new vehicle. Some tweaking of the script file will still be needed to get your Ferari to NOT behave like a dune buggy, but this I leave to you to figure out...
I have included the steps needed to create the vehicle, but there were many stumbles along the way that caused me a great many headaches for a number of weeks. I am including a few of the problems I had in the hopes that this may solve some of your problems, although, if my instruction is up to scratch you should hopefully NOT have to deal with any of these problems.
For the sake of playing it safe, though:
Q: David Macisaac was helping me create a reference vehicle and when I loaded his export of my file, his wheels always started off pointing straight ahead, but mine always started off fully turned to the left as far as the vehicle was set up to turn. I couldn't figure out why.
A: Well, the wheels have a max range of turn from left to right. It seems it loads fully turned to one side and then either straightens itself out or tests it's range. My problem was that my wheel mesh got stuck in my vehicle/collision mesh and hence never got to move from that point, giving the impression that the wheels were facing a different direction from the hub rotation.
Q: In the (very) few online tutorials I could find about vehicle creation, they stated that the required nodes are mass, cam, eye, mount0 [.. mount9] and ground0 to ground3.
A: False! The nodes ground0 to ground3 are in fact NOT used, but should be replaced with hub0 to hub3 nodes.
Q: When my vehicle loads, my vehicle seems tilted and my front and rear wheels are not aligned even though I set the hight values manually and set a keyframe on them. My front/rear wheels are now stuck in the vehicle mesh.
A: In the script, the mass variable determines how far the vehicle is pushed down and kept back up again by the springs. With a high mass value, combined with weak springs, the vehicle will tilt (and here is the key) in the direction of your mass node. If you place your mass node in the center of mass (as according to you), the vehicle will tilt and get stuck in it's own wheels. By placing the mass node right in between the 4 hubs, your vehicle's weight will be distributed correctly.
Q: When I correctly modeled my vehicle, my wheels appear in different, seemingly random, locations.
A: The problem was not with the vehicle mesh, but rather with the pivot point in the bounds mesh of the wheel shape.
Q: In my game, my wheels seem to rotate around the tip of the wheel, instead of spinning in place
A: Once more, the problem lies with the pivot point of the bounding box of the wheel shape. Place it at the center of the shape and your problems are solved.
Q: After modelling my wheel to face in the right direct and placing the pivot points in the correct place, my wheel now loads turned on it's side and spins erratically.
A: This took me ages to figure out. As soon as I got everything working, it all got messed up again due to this: When I freeze transformations on the bounding box, the bounding box gets rotated. My Maya settings work with y pointing up, but Torque works with z facing up. When you click on "Create bounds", it automatically rotates the bounding box in such a way that your model appears correctly. By freezing transformations on the bounding box, you reset the rotation and that loads your model incorrectly in game. The solution: when you freeze the bounding box, click the options box and DESELECT rotation before committing the freeze transform.
That is all I have to say on this matter. I hope this is of use to some of you and wish you the best of luck.
Please note that the model I am including (for the time being that is) is a part of the DarkMatter package and as such you may not use it in your own games unless you purchase the package from [url="http://www.thegamecreators.com"]here[/url]. I will replace the model later on and remove this paragraph, but for now, please respect their copyright.
Thanks go to David Macisaac for his assistance.
You pointed me in the right direction and gave me loads of support and plenty of your time. Thanks for that. It is really appreciated.
As a final note before I sign off: to create a new vehicle, all you need do now, is import your shape, replace the current shape and collision mesh, then play with the nodes and set the keyframes for each hub node and you are done. Real simple. Your entire hierarchy is already in place for you :) Enjoy!
Now, I do have a small request to ask of you guys and gals, if you wouldn't mind...
Please help me create a free resource site for Torque users. Since not everyone is good at modeling, and content can be hard to come by, if you find this resource useful, please consider giving me your new vehicles for download from my site.
If we all share our resources for free we can all get busy making games instead of scrounging around for content. It's just a thought. No need to pay me any mind if you don't want to :D
Anyway, here it is, enjoy :D
#2
12/26/2006 (10:41 am)
thank you Jacco , if this document have a image , is good
#3
04/20/2009 (10:24 pm)
hi jacco the above document is very good none were as helpful as yours. Good job and hey the link to resource is broken .can you please fix it. i am gonna upload my resource once it is ready. thanks again.
#4
10/22/2009 (1:42 pm)
Hi everybody, I followed this tutorial and read another forums, but im having a problem when i load my car in torque, i build a 4 wheel car, but in torque my car load only with the 2 front wheels, the back 2 wheels doesnt appear, i have trying many things but the problem continuous, i dont know what could it be? help please.... 
Tahlilgarantadbir
Default Studio Name