btRaycastVehicle Troubles™ (in JavaScript, to boot)

sinxtanx
Posts: 1
Joined: Wed Apr 30, 2014 1:12 pm

btRaycastVehicle Troubles™ (in JavaScript, to boot)

Post by sinxtanx »

So I'm trying to get this car to behave, right?
Driving around a track, everything is fine and dandy, when suddenly the rigidbody collides with the track and makes the car just FLIP THE FLIP OUT.
It's frustrating to say the least. Even just sidling up against a wall and going slowly forward, the car will occasionally VIOLENTLY collide with the wall, much more than you'd think be possible. It's like the solver just suddenly decides that "Nope, you gettin' ejected son" and then applies the fury of one hundred armored knights on the rigidbody.

Is there any way I can make the rigidbody just, kind of, "slide off" any collisions? I've tried setting both friction and restitution on the car and the track to zero, that had no effect other than just make the car slide around in a silly way when upsidedown.

P.S. I'm using Ammo.js, because the entire project is for the web in JavaScript. Since it's pretty much literally the same code, I should be able to (somehow) apply any solution someone might have.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: btRaycastVehicle Troubles™ (in JavaScript, to boot)

Post by Basroil »

Usually you'll get that sort of thing if you set your simulation rate too low for the velocities involved. If you're talking about a 3m long car moving 45 units a second (roughly equivalent in meters) with a 60hz simulation, you'll be 0.6 units inside the wall by your next check if you were just outside it before. The error correction will try to fix all that in a few frames, and the equivalent forces can be huge. Try running it with higher framerates, it should help a bit.