Billiard / pool physics and ghost collision test

Hi,

I tried to create a billiard / pool game and run into some I ghost collision issues.
The ball physics does not seem right as well.

Take a look at it and drop your fix or your completely new approach.
TestAlignRot.blend (848.6 KB)

1 Like

It’s a matter of mass, friction, elasticity.
(Also there might be bugs with edges of triangulated planes by the engine. Means the balls might jump when crossing invisible edges)

I couldn’t really understand your controls but I remembered a Billard Table from an earlier game I made in UPBGE 0.36.1.
Took it and made a little rough demo now.
03_Billard.blend (4.4 MB)

My work on this is CC0. Take it and make it.

7 Likes

This is great, but you should limit the white ball from jumping off the mat.

1 Like

Good eyes and good idea! Fixed!

Added some FineTuning (angle and cue tip position) for effet.

2 Likes

there might be bugs with edges of triangulated planes by the engine. Means the balls might jump when crossing invisible edge

Yeah, that is what i meant by ghost collision and wondered if there is a fix.
Sorry about my controls.
Thanks for sharing.

As a workaround I capped the z-position of every Ball:
obj.worldPosition.z = min(obj.worldPosition.z,-11.5)

Alternatively capping the z-velocity also works:
obj.worldLinearVelocity.z = min(obj.worldLinearVelocity.z,0.01)

Balls can’t go up but can fall into the holes. (unless you WANT to make artistic flying Ball movements :slight_smile: )

1 Like
  • out of boredom I capped the placement and rotation of the cue and made it more visible.

  • White ball will automatically respawn

  • possible to press Enter to restart game

I guess this workaround is ok for a pool game

I think in your file you can set collision type to box. Looks like you are using UPBGE 0.2.5 or similar.
TBH I had to try hard to see any bad behavior in your file but I could see it jump over the invisible edge sometimes (switched on physics visualization)
With box-collision type there is no edge in physics visualization and also there seemed no jumps.
In my file I had to edit the plane so the main plane only has 1 bad edge. Before there were many, due to the many vertices of the corner holes.
Looks like it isn’t so easy to make a “perfect” Billard game :slight_smile:

BTW my version is now part of this:

1 Like

I checked your video. :+1:

1 Like

Added a simple aiming indicator to the above file.
Press H to turn this help On/Off.

3 Likes

good feature :+1:

Here’s a version with added wall bounce indication.
For now it’s more a debug tool than a help.
For trying to find better physics settings for walls and balls until they match what the indicator shows.
03_Billard_bande.blend (4.4 MB)

1 Like