Wheeled Vehicle Update
by Tim Gift · in Torque Game Engine · 02/15/2002 (9:47 am) · 118 replies
Just moving this thread over from the news items as that was starting to get a little long.
I went ahead and changed the wheeled vehicle to use datablocks for both the tire and spring parameters. The datablocks are set dynamically for each wheel, so you can mix and match suspension and tires...
The tire datablocks also includes the tire shape, so the car body no longer includes the tires. Getting those to render correctly has been a pain in the butt, mainly because MilkShape mangles it's node transforms (and you can't edit them, etc. very annoying). This wasn't so much of a problem when the tires were in the shape, but now that I'm trying to attach them to the hubs, it's lame. Anyway, because I've been having trouble getting the node transforms in MilkShape oriented correctly, I decided to bag it and do all the animations in code. That means the new minimum requirements for a car body is that it contains the root position of the hubs, that's it.
I have it pretty much all working, but rendering the wheels as separate shapes, and the new datablocks has complicated the code a little. I'm going to take some time and do a little more cleanup and re-factoring before I check it all in.
On the animations... the suspension and steering animations are still there, and are still being run, but now have nothing to due with the physics at all, or the placement of the wheels. (You won't even need any animations to import a new car.) You will still be able to do suspension and turning animations though if you want, and the code will try to line them up. I'll put some suspension struts in the test car later and make sure that code is all working correctly :)
I'll post back on this thread when it's checked in... this will, of course, mean re-doing any current test shapes you have, but that's life on the edge :O
I went ahead and changed the wheeled vehicle to use datablocks for both the tire and spring parameters. The datablocks are set dynamically for each wheel, so you can mix and match suspension and tires...
The tire datablocks also includes the tire shape, so the car body no longer includes the tires. Getting those to render correctly has been a pain in the butt, mainly because MilkShape mangles it's node transforms (and you can't edit them, etc. very annoying). This wasn't so much of a problem when the tires were in the shape, but now that I'm trying to attach them to the hubs, it's lame. Anyway, because I've been having trouble getting the node transforms in MilkShape oriented correctly, I decided to bag it and do all the animations in code. That means the new minimum requirements for a car body is that it contains the root position of the hubs, that's it.
I have it pretty much all working, but rendering the wheels as separate shapes, and the new datablocks has complicated the code a little. I'm going to take some time and do a little more cleanup and re-factoring before I check it all in.
On the animations... the suspension and steering animations are still there, and are still being run, but now have nothing to due with the physics at all, or the placement of the wheels. (You won't even need any animations to import a new car.) You will still be able to do suspension and turning animations though if you want, and the code will try to line them up. I'll put some suspension struts in the test car later and make sure that code is all working correctly :)
I'll post back on this thread when it's checked in... this will, of course, mean re-doing any current test shapes you have, but that's life on the edge :O
#102
03/01/2002 (3:03 pm)
thnx kevin :)
#103
Unfortunately, when I load the mission the vehicle is not in the right place, in fact I can't see it anywhere. By looking at the object inspector in the editor it would appear that no matter where I save the car, it loads up at 0,0 and is travelling across the negative Z axis (falling?) very fast.
Now my guess as to what is happening is that the car is being loaded at pos(0,0,0) regardless of what it says in the mission file. Because this position is underneath the landscape the car is continously falling, which is why each time I refresh the editor display, the car has moved a lot down the z-axis.
Also, according to the editor inspector, the car is rotated around 1,1,0 regardless of what it is saved as.
So in summary, I think that vehicles are loaded OK from a mission file, but their position and orientation is not.
Why isn't the car loading up in the right place?
Has anyone else managed to save a vehicle position in a mission and reload it successfully?
Thanks.
03/01/2002 (3:04 pm)
Now that I can add vehicles via the mission editor, I want to be able to save their position (like I can with other objects) so when the mission is loaded, the vehicles are already in place.Unfortunately, when I load the mission the vehicle is not in the right place, in fact I can't see it anywhere. By looking at the object inspector in the editor it would appear that no matter where I save the car, it loads up at 0,0 and is travelling across the negative Z axis (falling?) very fast.
Now my guess as to what is happening is that the car is being loaded at pos(0,0,0) regardless of what it says in the mission file. Because this position is underneath the landscape the car is continously falling, which is why each time I refresh the editor display, the car has moved a lot down the z-axis.
Also, according to the editor inspector, the car is rotated around 1,1,0 regardless of what it is saved as.
So in summary, I think that vehicles are loaded OK from a mission file, but their position and orientation is not.
Why isn't the car loading up in the right place?
Has anyone else managed to save a vehicle position in a mission and reload it successfully?
Thanks.
#104
Had to change all my physics variables in script again. I think it's working now, not sure about the hover, it no longer floats in water but I seem to be able to NOT shoot into space whe nI hit a bump.
03/01/2002 (7:53 pm)
Blah.Had to change all my physics variables in script again. I think it's working now, not sure about the hover, it no longer floats in water but I seem to be able to NOT shoot into space whe nI hit a bump.
#105
I've been trying to debug a problem that surfaced mysteriously this pm where I'd get a "Connection error: Invalid packet.." message, followed by a fatal assert everytime I changed to camera mode from player mode.
After several hours of stepping through the debugger, I tripped over the fact that the vehicle I was spawning was NOT being created with a -Z value. Along the line, I'd edited it's position in the mission file to match that of a marker That I had placed a few metres above ground. Upon reflection, it was immediately after I did that that the Connection Errors began. I deleted the vehicle from the mission, and my problems went away.
Inserted vehicle into game, no problems. Saved mission with vehicle in place. Exited, returned with vehicle below ground and plummeting fast, no problems (other than that one). Exited, edited the mission file to put the vehicle back above ground by several metres. Invalid packet & crash.
hmmmmm.....
03/03/2002 (4:56 pm)
Richard, what you are describing is more serious than it first seems :-)I've been trying to debug a problem that surfaced mysteriously this pm where I'd get a "Connection error: Invalid packet.." message, followed by a fatal assert everytime I changed to camera mode from player mode.
After several hours of stepping through the debugger, I tripped over the fact that the vehicle I was spawning was NOT being created with a -Z value. Along the line, I'd edited it's position in the mission file to match that of a marker That I had placed a few metres above ground. Upon reflection, it was immediately after I did that that the Connection Errors began. I deleted the vehicle from the mission, and my problems went away.
Inserted vehicle into game, no problems. Saved mission with vehicle in place. Exited, returned with vehicle below ground and plummeting fast, no problems (other than that one). Exited, edited the mission file to put the vehicle back above ground by several metres. Invalid packet & crash.
hmmmmm.....
#106
03/03/2002 (5:14 pm)
The specific assert is the one in bold below (from consoleObject.cc)ConsoleObject* AbstractClassRep::create(const S32 in_classId)
{
AssertFatal(initialized, "creating an object before AbstractClassRep::initialize.");
AssertFatal(in_classId >= 0 && in_classId <= MaxClassId, "Class id out of range.");
[b]AssertFatal(classTable[in_classId] != NULL, "No class with declared id type.");[/b]
if(classTable[in_classId])
return classTable[in_classId]->create();
return NULL;
}
#107
2. My problem seems to be related to client/server synchronization problem of some sort ... gaaaa...
[EDIT} My problem has been fixed:
in item.cc there is this, around line 877
I was missing the 'else'. Must have been one those leave-the-editor-open-and-go-to-the-store-while-the-kids-invade-the-office sort of errors... ya know ? :-)
03/03/2002 (5:36 pm)
1. The problem I describe is not present in the March 2 head, so it must be something in my code. The problem Richard describes *is* in the March 2 head, however.2. My problem seems to be related to client/server synchronization problem of some sort ... gaaaa...
[EDIT} My problem has been fixed:
in item.cc there is this, around line 877
if ((mAtRest = stream->readFlag()) == true)
mVelocity.set(0,0,0);
[i]else[/i]
mathRead(*stream, &mVelocity);I was missing the 'else'. Must have been one those leave-the-editor-open-and-go-to-the-store-while-the-kids-invade-the-office sort of errors... ya know ? :-)
#108
You can either look at the code (might be a little tricky to sort through), or you could try putting a little script loop in start game that puts a vehicle at all the markers in a group. That way you just place markers in the editor.
03/04/2002 (9:27 am)
Richard... many of the client control objects aren't setup to be saved with the mission, I believe this includes the player. They were just never designed that way, it's way they initialize themselves from the saved properties. I'm sure this can be corrected, but it would not be high on my list right now, CGDC is comming up quick and I have a few things on my plate for that.You can either look at the code (might be a little tricky to sort through), or you could try putting a little script loop in start game that puts a vehicle at all the markers in a group. That way you just place markers in the editor.
#109
Tim, I have been wandering the same thing about having vehicles already placed when they game initializes. Thank you for turning the light bulb on about the markers.
03/04/2002 (10:21 am)
Tim, I have been wandering the same thing about having vehicles already placed when they game initializes. Thank you for turning the light bulb on about the markers.
#110
The way that I am doing the model is by using splines to trace around the car and then creating the mesh from the splines so it would be a shell and I am just wondering if it needs to be a solid object?
To get an idea of how I am doing it check out this site:
http://www.suurland.com/blueprints_howto_max.htm
03/18/2002 (6:05 am)
I am modeling a car for a game called nitee racing and I am just wondering if I am making the model the right way?The way that I am doing the model is by using splines to trace around the car and then creating the mesh from the splines so it would be a shell and I am just wondering if it needs to be a solid object?
To get an idea of how I am doing it check out this site:
http://www.suurland.com/blueprints_howto_max.htm
#111
03/18/2002 (7:25 am)
solid no, but if you do it that way to have the smooth looking car. . .your poly count is gonna shoot thru the roof
#112
02/19/2005 (4:26 pm)
I'm having trouble just getting my axles to control the motion of my hub nodes cause the hubs don't animate once they're in Torque. I'm using GameSpace, and I parent each hub node to its respective axle and then animate the axle. I'm calling each sequence "spring#" where # is the corresponding hub node #. Does anyone have any advice as to how to properly animate the hubs so that they properly follow the suspension motion of the axles? Thanks
#113
Ive never used Gamespace, so I dont know what the exporter looks like, but if its anything like Max's, you also need to bump up the frames per second for each sequence. In max, you bump it up to 100... But like I said, I havent used Gamespace, so this may not even apply.
Also, you may want to check your vehicles script file. One problem I ran into was the fact that I was animating the suspension to have a relatively small area of movement. In the script, though, my suspension length was at .85.... which was much to long for what I was doing. I changed the length in the script to .35 and everything worked fine.
02/20/2005 (11:52 am)
How are you placing your keys? The first key should be the suspension in the up position, and the second key should be in the down position. Also, Im not sure why it matters, but its good to have a 3rd key that is the suspension back in the up position.Ive never used Gamespace, so I dont know what the exporter looks like, but if its anything like Max's, you also need to bump up the frames per second for each sequence. In max, you bump it up to 100... But like I said, I havent used Gamespace, so this may not even apply.
Also, you may want to check your vehicles script file. One problem I ran into was the fact that I was animating the suspension to have a relatively small area of movement. In the script, though, my suspension length was at .85.... which was much to long for what I was doing. I changed the length in the script to .35 and everything worked fine.
#114
02/25/2005 (9:08 am)
Well, its still not working and I'm starting my animation with the hub nodes in the up position. Do the threads need to be scripted in anywhere because I can get animations to play correctly in the Show Tool, including the hubs, but for some reason the hubs aren't being controlled by the thread that being played for them once they're exported to Torque.Does anyone here on this forum know GameSpace thats had success with suspension animation?Thanks
#115
03/07/2005 (11:18 am)
Okay so now I'm using MAX for my vehicles and I've got two problems. When I use MAX4, my hub nodes don't mount my wheels but my environment mapping shows up correctly.When I use MAX7, my wheels mount fine but I don't get any environment mapping. E- map is set to true and I have the reflection slot checked. So why am I having two different problems with each version of MAX i use. I would assume that things that work fine in MAX 4 (i.e. environment mapping ) ought to work fine in MAX 7 as well. WHy do things like this get broken in later versions of the exporter? Thanks for any help.
#116
Use unmessdts on your Max7 export to get your environment mapping back. Had the same problem and wracked my head for a long time before finding that.
- JS
03/08/2005 (1:51 pm)
@AndrewUse unmessdts on your Max7 export to get your environment mapping back. Had the same problem and wracked my head for a long time before finding that.
- JS
#117
03/10/2005 (8:46 am)
Wow,thanks Jeremy, that solved my problems. What exactly is that executable doing to allow the environment mapping to show up all of a sudden? Just curious.
#118
04/06/2005 (11:48 am)
Hello, I'm wondering how to make my "turn" sequences to work independantly of my "spring" sequences for my vehicle. Right now, the turn sequences seem to be affecting how the spring animations play, and the weird thing is both animations occur at different points in my timeline.
Torque Owner Tim Gift