Car Upside Down - How do I check this?
by Andrea Bigiarini · in Torque Game Engine · 07/12/2004 (1:20 am) · 17 replies
I'm making practice on TGE studying the "starter.racing" mod in the example folder.
As you've noticed, when you go upside down (wheels up) nothing happens.
How can I calculate and inform the program that the car is upside-down and blocked ?
Calculating the absence of collision for all the wheels * amount of time?
Calculating that the car is rotated * amount of time?
When I've found this I can:
0. Get the spawnSphere location
1. Get the player location
2. Move the spawnSphere at this location.
3. Remove player shape
4. Re-spawn player at the sphere loc.
5. Reset spawnSphere position.
// In point 4 maybe I must check also the validity of the spawning position in a "legal" area.
Example: Car go outside race track and fall down a cliff <---- Illegal respawn position ... but this is another story ...
Ok folks thanks for the answers.
This is a fantastic community and I feel like home ....
Andrea
As you've noticed, when you go upside down (wheels up) nothing happens.
How can I calculate and inform the program that the car is upside-down and blocked ?
Calculating the absence of collision for all the wheels * amount of time?
Calculating that the car is rotated * amount of time?
When I've found this I can:
0. Get the spawnSphere location
1. Get the player location
2. Move the spawnSphere at this location.
3. Remove player shape
4. Re-spawn player at the sphere loc.
5. Reset spawnSphere position.
// In point 4 maybe I must check also the validity of the spawning position in a "legal" area.
Example: Car go outside race track and fall down a cliff <---- Illegal respawn position ... but this is another story ...
Ok folks thanks for the answers.
This is a fantastic community and I feel like home ....
Andrea
#2
The links is good and helpful.
Yes, the path and various spawn zone is the right and easy way to solve the legal respawn problem.
Can I place them manually or I can do via scripting?
"OOB" means "out of bounds" like golf?
No problem if the car is OOB but the real problem is turned over.
I've made a forum research but I can't find nothing regarding this problem (and I don't know the words to describe this "wheel up" in english).
Regarding the "Futuristi Feeling" is a plan that I have since 1984.
I'm always think if Tommaso Marinetti, Umberto Boccioni or Fortunato Depero (both of the Futuristi movement) have had a computer what they have done ($h*t my english is awful ..)
If you search for these artists (mostly Depero) you'll see that they really invented 3D.
www.depero.it/sum-eng.html profile
www.ubu.com/sound/depero.html sounds (you must download these)
They where the real last artists movement in Italy and they have made a real revolution in the art all around the world.
Roberto Sironi and Libera are the kind of artists/achitech that I love go here
faculty-web.at.nwu.edu/art-history/werckmeister/Week%20Four/weekfour.htm
and see what kind of interiors I would like to see in a game.
If you're not bothered I'll continue next post to show you what I've in mind.
Greets from Roma buddy
Andrea
07/12/2004 (6:24 am)
THX Gonzo ... I've done ... ballots .... ehehe .. ;)The links is good and helpful.
Yes, the path and various spawn zone is the right and easy way to solve the legal respawn problem.
Can I place them manually or I can do via scripting?
"OOB" means "out of bounds" like golf?
No problem if the car is OOB but the real problem is turned over.
I've made a forum research but I can't find nothing regarding this problem (and I don't know the words to describe this "wheel up" in english).
Regarding the "Futuristi Feeling" is a plan that I have since 1984.
I'm always think if Tommaso Marinetti, Umberto Boccioni or Fortunato Depero (both of the Futuristi movement) have had a computer what they have done ($h*t my english is awful ..)
If you search for these artists (mostly Depero) you'll see that they really invented 3D.
www.depero.it/sum-eng.html profile
www.ubu.com/sound/depero.html sounds (you must download these)
They where the real last artists movement in Italy and they have made a real revolution in the art all around the world.
Roberto Sironi and Libera are the kind of artists/achitech that I love go here
faculty-web.at.nwu.edu/art-history/werckmeister/Week%20Four/weekfour.htm
and see what kind of interiors I would like to see in a game.
If you're not bothered I'll continue next post to show you what I've in mind.
Greets from Roma buddy
Andrea
#3
OOB = out of bounds
"wheel up" in english = upside down or inverted
check the function at the bottom of this thread..
www.garagegames.com/mg/forums/result.thread.php?qt=17992
I think it could actually determine if your car is inverted, but I'm not sure. If you are making your own vehicles I could think of a very easy way to do it. If your using the starter racing kit then I don't know if it could be done.
The art links are great, but the sounds are frustrating. I speak zilcho italiano. That is, I think it was italian. lol
07/12/2004 (6:49 am)
You can place them both ways, although the scripted version would require a lot of coding to get it to come out right no matter what the map.OOB = out of bounds
"wheel up" in english = upside down or inverted
check the function at the bottom of this thread..
www.garagegames.com/mg/forums/result.thread.php?qt=17992
I think it could actually determine if your car is inverted, but I'm not sure. If you are making your own vehicles I could think of a very easy way to do it. If your using the starter racing kit then I don't know if it could be done.
The art links are great, but the sounds are frustrating. I speak zilcho italiano. That is, I think it was italian. lol
#4
Regarding the vehicles I've bought from the Bravetree guys the Car Pack. It's still packed because I don'have time to have a look.
I'm testing the TGE now, and for better understand I work on something done.
It's about a week that I'm collecting forum posts and links, I'll use it for serious programming from 16th of July ---> me, my wife, my Fujitsu/Siemens 3GHZ Portable and my companion book from the one and only CERDIP Finney ... perfect holiday!!!
Yes my plans are studying the starter.racing damo then create Interiors (I hate Quark), models and terrains by myself and solve all the basics... meanwhile ...
Find some Bucks from some rich men in Montecarlo and start to develop a quick and dirty massive multiplayer race game.
Found the bucks I'll form a small team here in Rome and if I need external programming help (as I think) I'll be around here looking for someone who don't know Italy and want to pass a retributed month here (full expenses payed).
GOZO 4 PRESIDENT ...
Andrea
07/12/2004 (7:23 am)
Ahahaha that was a joke and for 80% is an invented quasi-italian-language .... ;)Regarding the vehicles I've bought from the Bravetree guys the Car Pack. It's still packed because I don'have time to have a look.
I'm testing the TGE now, and for better understand I work on something done.
It's about a week that I'm collecting forum posts and links, I'll use it for serious programming from 16th of July ---> me, my wife, my Fujitsu/Siemens 3GHZ Portable and my companion book from the one and only CERDIP Finney ... perfect holiday!!!
Yes my plans are studying the starter.racing damo then create Interiors (I hate Quark), models and terrains by myself and solve all the basics... meanwhile ...
Find some Bucks from some rich men in Montecarlo and start to develop a quick and dirty massive multiplayer race game.
Found the bucks I'll form a small team here in Rome and if I need external programming help (as I think) I'll be around here looking for someone who don't know Italy and want to pass a retributed month here (full expenses payed).
GOZO 4 PRESIDENT ...
Andrea
#5
I'll play with this problem and see if I can get a good solution done, it'll be a good learning exercise for me. ;)
07/12/2004 (7:23 am)
I'll try to figure this out later today when I'm home from work. But you should be able to call vehicle->getCameraTransform, or just vehicle->getTransform. Then check to see if the transform is upside down. I think it'll be the roll and/or pitch.I'll play with this problem and see if I can get a good solution done, it'll be a good learning exercise for me. ;)
#6
You're already inside the "Thanks to" section of my demo.
Great Community!
07/12/2004 (10:53 am)
THX Brian, always present to help all.You're already inside the "Thanks to" section of my demo.
Great Community!
#7
What do you think: valueToCheck!=normalVehiclePosition for a bunch of seconds?
"We are watching the Future on a rearview mirror ..." Marshall McLuhan
07/12/2004 (11:02 am)
P.S. About the vehicle.getTranform ...What do you think: valueToCheck!=normalVehiclePosition for a bunch of seconds?
"We are watching the Future on a rearview mirror ..." Marshall McLuhan
#8
07/12/2004 (12:26 pm)
The way I check for upside down is to use getTransform, then check the z component of the 'up' vector. If it is negative, the vehicle is upside down.bool WheeledVehicle::isUpsideDown()
{
Point3F up;
getTransform().getColumn(2, &up);
if(up.z < 0)
return true;
return false;
}
#11
// RIGID BODY ***************
massCenter = "0 -0.5 -0.5"; // <-- last value from 0.5 to .09 is good
This lower the center of the mass of the car and help to put the car always on his wheels.
Greets
Andrea
07/13/2004 (2:26 pm)
This problem can easy solved with this(in car.cs):// RIGID BODY ***************
massCenter = "0 -0.5 -0.5"; // <-- last value from 0.5 to .09 is good
This lower the center of the mass of the car and help to put the car always on his wheels.
Greets
Andrea
#12
I don't think this is totally proper, the checkforupsidedown function should probably be added to DefaultCar or just WheeledVehicle or something. ;)
Thanks for comments btw! I'm just learning this stuff like you are. ;)
Oh yeah, if you play with these constants in WheeledVehicleSpring:
length = 0.90; // Suspension travel
force = 3500; // Spring force
I changed mine to 0.45 and 1500, the car almost never flipped. ;)
07/13/2004 (2:26 pm)
I played around with the ideas from the other thread and got this pretty quickly. Add it to the end of car.cs. It'll check for upside down case when firing trigger is kicked off. You could also schedule a timer to see if the car has been upside for x seconds or something silly like that. ;)I don't think this is totally proper, the checkforupsidedown function should probably be added to DefaultCar or just WheeledVehicle or something. ;)
Thanks for comments btw! I'm just learning this stuff like you are. ;)
Oh yeah, if you play with these constants in WheeledVehicleSpring:
length = 0.90; // Suspension travel
force = 3500; // Spring force
I changed mine to 0.45 and 1500, the car almost never flipped. ;)
function WheeledVehicleData::CheckForUpsideDown(%this, %obj)
{
%transform = %obj.getTransform();
%angAxis = getWord(%transform, 3) SPC
getWord(%transform, 4) SPC
getWord(%transform, 5) SPC
getWord(%transform, 6);
%tmat = VectorOrthoBasis(%angAxis);
%upVectorZ = getword(%tmat, 8);
if (%upVectorZ < 0.0) {
return true;
} else {
return false;
}
}
// data = datablock
// obj = object number
// trigger = 0 for "fire", 1 for "jump", 3 for "thrust"
// state = 1 for firing, 0 for not firing
function WheeledVehicleData::onTrigger(%data, %obj, %trigger, %state)
{
if (%data.CheckForUpsideDown(%obj)) {
%obj.setTransform(pickSpawnPoint());
}
}
#14
07/14/2004 (1:08 pm)
You could always have a script callback for whenever the vehicles upside down. I added Chris's code to wheeledVehicle update move like this(at the bottom of the function):Point3F up;
getTransform().getColumn(2, &up);
if(up.z < 0)
{
Con::executef(mDataBlock,2,"onFlipped",scriptThis());
}
#15
07/14/2004 (2:02 pm)
In some cases, being upsidedown is not the issue, but rather being stuck upside down. You might actually be still rolling and end up on your wheels at the end. An additional check for zero (or really low, since it'll be a floating point comparison) movement woud be good.
#16
07/14/2004 (10:54 pm)
I'm planning on adding that feature, but it works for now.
#17
Cool! Where are we going on our holiday? Should I bring my swimming trunks? (I used to Scuba Dive south of Livorno :-)
07/15/2004 (10:43 am)
Quote:Andrea
It's about a week that I'm collecting forum posts and links, I'll use it for serious programming from 16th of July ---> me, my wife, my Fujitsu/Siemens 3GHZ Portable and my companion book from the one and only CERDIP Finney ... perfect holiday!!!
Cool! Where are we going on our holiday? Should I bring my swimming trunks? (I used to Scuba Dive south of Livorno :-)
Torque Owner Gonzo T. Clown
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2347
One way you can solve your spawning problem is to use pathmarkers along the center of your track at regular intervals like 50 to 100 game units(or whatever suits your needs) when it comes time to reset a player due to flipping or off track conditions, you can run a check to find the marker that is closest to the players current position and use the markers X, Y, and rotational coordinates combined with the above links method of finding the Z coordinate to set their position back on the center of the track and pointing forward. If you have difficulty tying all this together let me know, I'd be glad to assist you. I checked your profile and I'm facinated to see more of this "Futuristi feeling" game you speak of.
As for figuring out the best way to determine a car is OOB or turned over, I'll have to give that some thought, the games I'm working on are not yet into the vehical stages.