Skip to content

Missing cushion collision #217

@LeXXik

Description

@LeXXik

Under some conditions, e.g. in a billiards game, no pockets, when you hit a corner, the ball will go outside of table bounds.

Make a square table, place the ball somewhere at the diagonal and shoot at 45 degrees:

cue = pt.Cue(cue_ball_id="cue")
cue.set_state(2.0, 45, 0, 0, 0)

table_specs = pt.objects.BilliardTableSpecs(l=4.5, w=4.5)
table = pt.Table.from_table_specs(table_specs)

cue_ball = pt.Ball.create("cue", xy=(1, 1))
obj_ball = pt.Ball.create("obj", xy=(10.0, 10.0)) # have to create an object ball as it seems I can't have only a cue ball? :/

system = pt.System(table=table, balls=(cue_ball, obj_ball), cue=cue)

When it hits the corner, there will be 2 cushions at very close time delta to each other and only one cushion gets processed.

Also, probably related, if you place the cue ball right next to the cushion (table width/length minus ball radius) and shoot towards the cushion, the ball will also go outside of the table bounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions