Bike & Wheely [SOLVED]

I've been playing around with a demo for a bike game... It was going pretty well until I tried to make the bike do a wheely at which point I got stuck.

I've tried applying a force to the front tyre (to negate gravity), I've tried applying torque to the main bike body - these both kind of work but are a bit wobbly (the bike doesn't settle at the target angle.)

I've also tried using setTransform which was a complete failure... (that didn't surprise me, well, the way it failed surprised me, but not that it failed at all - I only tried it to be complete.)

Anyone got any ideas how I can approach this?

Thanks,

Charlie
If you apply an angular velocity to the back tire, your bike's front tire lifts off? Then, your bikes main body should change its angle. I would try to do something like this every time step:
Code:
if (body->GetTransform().GetAngle() > THRESHOLD) {
    body->SetTransform(body->GetTransform().position, THRESHOLD);
}

If you tried that... What exactly failed? Which behavior did you get?
Hi,
I did try something like that... the result was that the chassis moved, and the tyres remained fixed to their original positions, the joints stretching out...
I am just looking at the joints now, to see if I can do something different with them...
ok - further experimentation shows, that the very weird result of the stretching joints, actually only occurs if the body is asleep. So, that's easy to fix.

But, the rotation is very jerky...
Ok - I've had partial success.

If I make the axle static - I can set the rotation of the wheely perfectly. But, then the bike doesn't interact with the landscape correctly. For example, the bike stays horizontal from the front wheel when going up a ramp.... (see pic)
Attachment:
Flash001.png
Flash001.png [ 2.04 KiB | Viewed 50 times ]

If I make the axle dynamic - I can't set the rotation of the wheely very accurately (the best I can get is a stuttery movement.)

I had hoped to make the axle some sort of motor, so I could encourage it to raise, but that hasn't worked.
in case anyone's interested (and that may only be you visus)

I actually solved this by going back to an early version, which literally apllies a torque to the bike frame. Initially this had given me a sinusoidal motion, so also added into the torque 'equation' is something that factors in the rotational velocity of the frame - this smooths out the sinusoidal motion.

Applying torque works fine, but can still give some strange effects (as per the above image, albeit nowhere near as pronounced) so, I disable the wheely if the bike is in the air or going up a ramp.
charlie_says wrote:
in case anyone's interested (and that may only be you visus)

Mhh, I guess some more people are interested but are too shy to post something. 😉

Original thread: https://box2d.org/forum/viewtopic.php?t=5823