Wheel woes. (Solved sorta, but new questions in 2nd post.)

Post Reply
User avatar
reflectduets
Posts: 4
Joined: Fri Jun 17, 2016 10:03 pm

Wheel woes. (Solved sorta, but new questions in 2nd post.)

Post by reflectduets »

I seem to be having trouble using the RayCast vehicle implementation.

For starters, in debug draw mode, I am unsure what to make of the wheel's orientation. They are simply pink lines, but I don't know what direction they are supposed to be in.
Image
I have tried several different mixing ups and even set the angles to random values,yet when I use the function
EngineApplyImpulseToWheel nothing happens, ever. It's as if the function does nothing. I also tried directly adding torque to the wheels, but nothing as well.
Image

Nothing about the car makes any sense. Now, after further adjustments, it appears to be tilted, and sinking through the floor.

Do I have to add actual wheels, and hinge joints, or is this raycast 'magical' wheels?
Please help.
Last edited by reflectduets on Sat Jun 18, 2016 4:27 am, edited 1 time in total.
User avatar
reflectduets
Posts: 4
Joined: Fri Jun 17, 2016 10:03 pm

Re: Wheel woes. (Solved sorta)

Post by reflectduets »

Ok so after much trial and error I found that this is the proper configuration for wheels.
Image
I made the car into a compound shape with (4 cylinders, 1 box) instead of the box that it was. I wish that debug draw would show me the compound shape the cylinders seem to be invisible. The cylinders (compound mesh) seem to be necessary for the raycast car to function.
also, when I spawn the car 50 units above the thin floor, the wheels seems to fall through the floor and glitch more often than not. I foresee problems with the trimesh and it falling through. Is there a way to "thicken" the walls (backfaces) of the trimesh?

Also, my suspension settings had to be exactly perfect or else it would fall through the floor.

My trouble now seems to be getting the car to go in a straight line?
hiker
Posts: 83
Joined: Tue Oct 24, 2006 11:52 pm
Location: Australia
Contact:

Re: Wheel woes. (Solved sorta)

Post by hiker »

reflectduets wrote: I made the car into a compound shape with (4 cylinders, 1 box) instead of the box that it was. I wish that debug draw would show me the compound shape the cylinders seem to be invisible. The cylinders (compound mesh) seem to be necessary for the raycast car to function.
I assume you want to use the cylinders for the wheels? That should not be necessary at all - the (default) bullet vehicle uses raycast, no need to create actual wheels (unless you want to have a more 'detailed' simulation - but that depends on your use case).
also, when I spawn the car 50 units above the thin floor, the wheels seems to fall through the floor and glitch more often than not. I foresee problems with the trimesh and it falling through. Is there a way to "thicken" the walls (backfaces) of the trimesh?
Using 'm' for units: if you drop your object 50 m (with a gravity of 9.8 m/s^2) - the rigid body will fall around 3.2 second and have a speed of around 30 m/s (assuming my back-on-envelope calculations are correct). Assuming you are using the default time step size (1/60 s), the body will fall half a meter per bullet step. You would need suspension settings long enough to start acting in this one frame. plus really tweaked settings to make them strong enough to avoid the chassis ending in the ground (in which case the collision handling might push it back violently).

In supertuxkart, we are using special code to handle falls: ray-casts for wheels are longer than necessary (i.e. longer than the suspension), and we detect later if a kart is hitting ground for the first time (i.e. after being in air for a while). If this condition is detected, we add an artificial impulse to 'cushion' the fall of the kart - we compute the value of the impulse to allow for a smooth landing. See our code at:
https://github.com/supertuxkart/stk-cod ... t.cpp#L397

(note that we did other tweaks to the raycast vehicle).

Cheers,
Joerg
User avatar
reflectduets
Posts: 4
Joined: Fri Jun 17, 2016 10:03 pm

Re: Wheel woes. (Solved sorta, but new questions in 2nd post

Post by reflectduets »

hiker wrote:
reflectduets wrote: I made the car into a compound shape with (4 cylinders, 1 box) instead of the box that it was. I wish that debug draw would show me the compound shape the cylinders seem to be invisible. The cylinders (compound mesh) seem to be necessary for the raycast car to function.

I assume you want to use the cylinders for the wheels? That should not be necessary at all - the (default) bullet vehicle uses raycast, no need to create actual wheels (unless you want to have a more 'detailed' simulation - but that depends on your use case).

also, when I spawn the car 50 units above the thin floor, the wheels seems to fall through the floor and glitch more often than not. I foresee problems with the trimesh and it falling through. Is there a way to "thicken" the walls (backfaces) of the trimesh?

Using 'm' for units: if you drop your object 50 m (with a gravity of 9.8 m/s^2) - the rigid body will fall around 3.2 second and have a speed of around 30 m/s (assuming my back-on-envelope calculations are correct). Assuming you are using the default time step size (1/60 s), the body will fall half a meter per bullet step. You would need suspension settings long enough to start acting in this one frame. plus really tweaked settings to make them strong enough to avoid the chassis ending in the ground (in which case the collision handling might push it back violently).

In supertuxkart, we are using special code to handle falls: ray-casts for wheels are longer than necessary (i.e. longer than the suspension), and we detect later if a kart is hitting ground for the first time (i.e. after being in air for a while). If this condition is detected, we add an artificial impulse to 'cushion' the fall of the kart - we compute the value of the impulse to allow for a smooth landing. See our code at:
https://github.com/supertuxkart/stk-cod ... t.cpp#L397

(note that we did other tweaks to the raycast vehicle).

Cheers,
Joerg


My new problems are listed in this new thread.
http://bulletphysics.org/Bullet/phpBB3/ ... =9&t=11210

I believe your suggestion about the kart hitting the ground for the first time is helpful.
It makes me wonder.
In my other thread, I have a problem where the wheels fall through the ground always, if the cars mass exceeds a certain value. It doesnt matter what settings I give the suspension they always fall through the ground. Is there a bug in the physics engine that causes erratic behavoir when the kart hits the ground the first time only, or simply it does this every time the cart is in the air for a while?
Post Reply