Game Development Community

Motorcycle Tipping over

by Jeff Trier · in Torque Game Engine · 03/12/2003 (6:08 am) · 9 replies

Hi all,

I have created a motorcycle for my project. And it seems to work if I give it 4 wheels (for testing). But when I give it two and spawn it into the game, it tips over (which makes sence in the real world). Is there a tipping factor function or variable I can change in script that will allow my bike to stand upright?

Thanks guys and gals!

-Jeff

About the author

Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.


#1
03/12/2003 (6:14 am)
Give it 4 wheels but make 2 of them invisible, lol. (it *might* work...)
#2
03/12/2003 (6:16 am)
Here's a thought... well, it's more of a hack really. ;-)

You *could* create a set of "training wheels" for the bike, and set them so that they are not visible. Now at first this sounds unattractive, because these wheels would not allow your bikes to lean properly when in a turn, but there is a fix for that.

Set the "training wheels" to retract when the bike is in motion and you have inertia to hold you up, and detract back to the original position as the vehicle slows to a stop.

Now when you add in the rider (eventually) simply have his animations mirror that of the invisible wheels. The end result would be that as the bike accelerated, both the riders legs, and the invisible wheels would come off the ground and default to a mounted position, and as you decellerated, both would return to the ground, but it would appear that the rider was holding the bike up with his legs.

This is just off the top of my head... I'm working with cycles too, but they're hovebikes... totally different mechanics involved. ;-)

[Edit]
Doh! Ian beat me to it! ;-)
[/EDIT]
#4
03/12/2003 (6:19 am)
Hey thanks guys, that was fast!

This gives me something to go on. :)

EDIT:
I am curious as to how they did the cycles in Tribes 2. Another problem I am having is that the bike leans to the opposite direction when turning.

Thanks again,
-Jeff
#5
03/12/2003 (7:07 am)
The cycles you are refering to from T2 were hovervehicles. They inherit from a totally different class.
#6
03/12/2003 (7:58 am)
The problem is that you would need two totally different sets of controls -- one to control the 'lean direction' (center of gravity) of the motorcycle (which is what you do when you lean to one side or another), and one that actually controls the handlebars, like you are doing now.

If you are on a bike and you just turn the handle, without LEANING, you'll lean the opposite way, and tip over.

One thing you might try, though. Play around with REALLY sinking the center of gravity. If you go too far it might have weird effects, but that idea is that if the center of gravity is BELOW the ground, every time you turn you will probably lean the 'correct' way. If that works at all it will still be kind of a hack, but you'd be in good company -- lots of racing games use this same tactic to prevent people from flipping cars doing things like ramming a curb, for instance, or turning tightly with an SUV.
#7
03/12/2003 (1:01 pm)
Quote:If you are on a bike and you just turn the handle, without LEANING, you'll lean the opposite way, and tip over.

This is absolutely WRONG, motorcycles and every other two wheel vehicles change direction thru something called "counter steering".

At anything but walking speeds you MUST turn the handlebars the opposite direction to initate a turn. And the leaning in the desired direction is a direct result of the input on the handle bars.

Even at walking speeds "counter steering" works. You can lean a 2 wheel vehicle without turning, but you CAN NOT turn a 2 wheel vehicle without counter steering it.

I have spent enought time on the street not to mention the track to know how this works. But just for the uninitiated.

www.superbikeschool.co.uk/uk/machinery.shtml

caferacers.editthispage.com/stories/storyReader$961

ihome.ust.hk/~westland/new_page_3.htm
#8
03/12/2003 (5:11 pm)
Hey thanks for that added info guys. :)

Hmm, I suppose I could set up the cycle controls to make the player press left to turn right and vice versa. lol

-Jeff
#9
03/07/2005 (2:05 am)
@Jeff: Are you alive?