Friction of a ball and a lane

AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Friction of a ball and a lane

Post by AxeD »

Hi,
I'm trying to create a bowling lane simulation (just ball and lane). As far as I know, in reality at the start ball has only a Z anf Y spin and goes straight forward. After some distance it start to spin in X and start to turn left/right. I have noticed, that in bullet it doesn't matter if I give a friction for ball and lane close to 0.0f (lat's say 0.001f). When ball hits a lane it "jumps" a little left or right. Additionaly In a middle of a lane, I'm changing friction lineary, but a ball is not spinning well. It is not turning left/right. Any idea??

Lane - lenght 18m - friction 0.001 up to 1.0f
Ball - weight 7.2f - size 0.11f - fritction 0.21f
gravity 0.0f, -10.0f, 0.0f

Best regards
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Friction of a ball and a lane

Post by sparkprime »

You could try clocking the simulation at 200hz or higher, and also try using more solver iterations. Just to explore what's going on. Are you using a collision sphere and a collision plane?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Friction of a ball and a lane

Post by AxeD »

Clock at 200Hz is not an option for me. I'm trying this on a very slow hardware. Ball is btSphere and lane is a loaded mesh
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Friction of a ball and a lane

Post by Erwin Coumans »

Hi,

High Velocity Bowling for PlayStation 3 is a similar game using Bullet physics. It will take a considerable amount of tweaking to get satisfying results, in case you want to create a bowling game.
  • What kind of collision shape(s) do you use for the lane? You could consider using a btBoxShape for the main lane to improve quality and performance.
  • The ball is rather small, compared to internal Bullet tolerances. Increasing the Bullet object sizes and using a scaling factor will likely improve the simulation
  • Make sure the pins (if it is a bowling game) are deactivated at the start.
  • 200 hertz is probably still better, just for the simulation. You can do this by passing 1./200. as 3rd argument:

    Code: Select all

    int maxInternalSubSteps=10;//don't use more then 10 internal iterations
    dynamicsWorld->stepSimulation(realDeltaTime,maxInternalSubSteps,1./200.f);
    
  • Can you give us some performance numbers for your platform, where most of the time is spend?
Thanks,
Erwin
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Friction of a ball and a lane

Post by AxeD »

Hi Erwin.
I have tried with pins too. Everything is loaded as a mesh. Why:"Make sure the pins (if it is a bowling game) are deactivated at the start." ? And according to performance, I'm trying to have performance close to a ps2/Wii platform so I need to have 25-60fps (with pins or other objects). Right now I'm trying btBoxShape as a lane, but still it is not working well. I think I have to try scaling those objects. However there will be next limit - max size limit ? Current lane is 18.0f long.

Best Regards
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Friction of a ball and a lane

Post by Erwin Coumans »

25-60 FPS is likely the real graphics frames per second, the first argument to stepSimulation. The 200 hertz refers to the internal physics substep, the 3rd argument. PS2 / Wii should have no trouble using an internal _simulation_ substep of 200 hertz.

Instead of concave moving triangle meshes, pins should be modeled as convex objects, or a btCompoundShape of convex child shapes. One of the demos still contains some commented code for pin shapes (RayDemo?).

It is best to deactive pins at the start of the game, so they don't take any CPU cycles and they don't need to settle down. Also make sure to choose appropriate broadphase boundary sizes.

Hope this helps,
Erwin
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Friction of a ball and a lane

Post by AxeD »

Hmm... I can replace floor with btBoxShape. Current ball is a btSphere. Pins behave well and I'm worry that thay must stay. Only spin of a ball is a problem. I will try this 1.0/200.0f. Or maybe You have any example values of a friction for such situation?

Best
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Friction of a ball and a lane

Post by sparkprime »

I wonder how hard it would be to simulate the motion of the bowling ball down the lane manually, since it's quite a simple situation, as in the way one uses a custom tyre model instead of using a spinning cylinder for the wheel. When the ball reaches the end of the lane you could still use bullet to model the pins falling over. You could also use bullet for the initial "throwing" phase, swapping it out for the custom model when the ball collides with the lane.

As the ball goes down, you only really need to store -

* ball spin
* ball position
* ball velocity
* ball orientation (for graphics only)

and then recompute these values at each step, checking the position to see if it has fallen into the gutter or has reached the end of the lane.

It might be a bit of extra thinking and initial work to get this running, but having full control is probably less frustrating that trying to get bullet to behave the way you want it to, especially as you have a very specific idea of how it should behave.
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Friction of a ball and a lane

Post by AxeD »

I wonder how hard it would be to simulate the motion of the bowling ball down the lane manually, since it's quite a simple situation, as in the way one uses a custom tyre model instead of using a spinning cylinder for the wheel. When the ball reaches the end of the lane you could still use bullet to model the pins falling over. You could also use bullet for the initial "throwing" phase, swapping it out for the custom model when the ball collides with the lane.

As the ball goes down, you only really need to store -

* ball spin
* ball position
* ball velocity
* ball orientation (for graphics only)

and then recompute these values at each step, checking the position to see if it has fallen into the gutter or has reached the end of the lane.
Yep, I'm doing this with that way, however ball should to turn left/right according to a friction. In my situation I have no slide and turning of a ball. All I have is "shoot" left/right. Spin is to high or friction to high? I really don't know...And I recalculate phx. every frame. Additionaly, when ball touches lane for firs time it jumps little to left/right (according to a spi).