Game Development Community

Attaching Wheels to Motorcycle

by James Abraham · in General Discussion · 05/24/2004 (12:01 am) · 8 replies

Hi,

I hope this isn't in the wrong forum. But it deals with a few different things.

I created a motorcycle model that consists of four different mesh objects: Body, steering column, front suspension and rear suspension. The wheel is a separate file and is exported as a separate dts. I linked "hub" nodes to the exact location on the front and rear suspension where the wheels will be attached later. Of course, the wheels are scaled properly and share the same coordinate system as the bike.

Here is the error we get when trying to attach the wheels to the bike in game:

"setWheelSteering: wheel index out of bounds, vehicle has 14172807 hubs"
"setWheelPowered: wheel index out of bounds, vehicle has 14172807 hubs"

The error is occuring when the script goes to add a wheel for steering, and
a wheel for power - it's the stock script for adding those two items, so
it's not a customization issue.

I'm a beginner when it comes to creating working models for Torque. I'm basing my setup and hierarchy on the buggy and car example files. If someone wouldn't mind taking a look at my 3dsMax5 files I'd greatly appreciate it.

www.retro64.com/jim/bike01.max
www.retro64.com/jim/bike_wheel.max

#1
05/24/2004 (1:13 am)
Hi James,

I don't know if this will help or not, but it does show the code that displays the warning, so maybe Davis can figure it out from there (and perhaps the resource will help anyway?).

-Eric
#2
05/24/2004 (9:56 am)
Here's a further note on the behaviour that's being noted, from the programmer. If anyone with max/torque knowledge could check things out, I'd be appreciative (I'm heading up the project that involves the asset James is posting about).

"Ok, just finished doing some more testing on the bike, and here's the problem: For one reason or another, when you are exporting the wheel hubs don't seem to be showing up according to Torque (checking getWheelCount returns 0 - not 2 like it should) According to your dump file, the hubs are in there - but something is happening between export and engine."

- Cody
#3
05/24/2004 (3:49 pm)
A straight export of your file (using one of my vehicle scene config files) exported the hubs just fine, allowing tires to be mounted. So I have to ask if you have included hub* in your scene config's always export list?

On a side not, the collision mesh fails. It may export, but standard torque doesn't like it. Unless you have modified how your game loads collision meshes for vehicles, you will need to get rid of the sub-objects and make the collision mesh one single convex mesh.
#4
05/25/2004 (12:25 am)
Martin,

Thanks. The hubs were being ignored on export. That has now been fixed. I also fixed my collision meshes.

When you tried out the files I posted, were the wheels rotating on the correct axis in the demo? Because now I have a new problem. The wheels are at 90' from where they should be.

I found one thread that discussed this problem. But in that particular case, it was solved by adding a collision mesh and marker. This isn't the case with me. The wheel is a separate dts file with collision, start, dummy, bounds. I was also sure that the wheel was positioned according to my motorcycle file. I also made sure that the hubs shared the same cooridate system as everything else. Rotating the wheel in Max doesn't help either.

Jim
#5
05/25/2004 (1:37 pm)
I used one of my own wheels when I tested your model, so I didn't notice it yesterday...

What you need to do is select your wheel, it's collision mesh, and the bounding box, and rotate them 90 degrees left or right(in the top viewport). Since your wheel is mirrored it won't matter which direction it's rotated, but the side which faces the top of the viewport is the side that faces out away from the vehicle (on those with 3+ wheels).

After those are rotated, select the bounds box, then go into the hierarchy panel, under pivot, and click Align to World. The pivot of the bounds mesh is the referance used by torque for rotating and positioning the wheel.

Now if you don't want to go through all of that you could simply rotate the bounds box'x pivot 90 degrees left/right and it should accomplish the same thing. (I my self have made a habit of aligning my wheels so the outside face points to the top of the screen since most of mine are non symetrical)
#6
05/25/2004 (2:58 pm)
Hmm. I tried that. Still no luck. I did exactly like you said. Were you able to get mine to work?

What you said above is "on those with 3+ wheels". As you know mine only has 2 wheels. Could there be a problems with my hubs?
#7
05/25/2004 (6:48 pm)
Yes I got yours to work, mounted on your model with no changes made to the hubs. The refrence to the 3+ wheels has only to do with which side of the wheel faces out away from the vehicle. Of course since the motor cycle has only two wheels, the front will be mounted as if it were on the left side of a vehicle, the rear wheel will be mounted as if it were on the right. Here is a copy of the revision I did to get it to work (to ensure we are on the same page)

www.mechina.com/bike_wheel_new.zip
#8
05/25/2004 (7:42 pm)
Thanks a ton Martin! Yours does work. Funny thing is tho, when i view your rivised file, the outside of the wheel is not facing the top viewport. It is facing the front. It looks like you rotated on the world y axis. Anyways,.. it works now.

Thanks