Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect angle values in collisions #200

Open
DigitalDetective47 opened this issue Sep 18, 2021 · 1 comment
Open

Incorrect angle values in collisions #200

DigitalDetective47 opened this issue Sep 18, 2021 · 1 comment

Comments

@DigitalDetective47
Copy link

Below, I have created a simulation where a box lands on a flat floor.

import pymunk

space = pymunk.Space()
space.gravity = (0, -1)
box_body = pymunk.Body()
box_shape = pymunk.Poly.create_box(box_body, (1, 1))
box_body.position = (0, 20)
box_body.velocity = (0, 0)
box_shape.mass = 1
floor = pymunk.Segment(space.static_body, (-5, 0), (5, 0), 1)
space.add(floor, box_body, box_shape)
for _ in range(63):
    space.step(0.1)
print(box_body.angle)

When I run this code, I get a value of -4.8183679268731794e-14, rather than the 0.0 that I expect. I do, however, get 0.0 for all step counts less than 63, which correspond to times before the box hits the floor. When I change the step count to 64, I get 7.805375706901558e-15. I have discussed this with others on Stack Overflow, and everyone else seems to get the expected value of 0.0. I am on 64‐bit Windows 10 running Pymunk 6.2.0 with Python 3.9.7.

@viblo
Copy link
Owner

viblo commented Sep 19, 2021

Thanks for the report. After I tried a bit I managed to reproduce the error. Dont have a good answer yet, will do some experiments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants