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

Shapes added to space as static does not respect angle or position property #49

Closed
viblo opened this issue Oct 4, 2013 · 1 comment
Closed

Comments

@viblo
Copy link
Owner

viblo commented Oct 4, 2013

From AdsumM...@gmail.com on March 18, 2011 10:37:29

What steps will reproduce the problem? 1. Create a body with inf mass and inertia and use it to create a shape.
2. Add the shape to the space with space.add_static(shape)
3. Change the value of shape.body.angle or shape.body.position

The expected result would be that the body is moved or rotated to the angle or position it was changed to. What happens is that the shape.body object will report the new values but the collisions will still occur at the position and angle that was set before the call to space.add_static.

I'm running this on archlinux with pymunk 1.0.0 from archlinux aur

Original issue: http://code.google.com/p/pymunk/issues/detail?id=50

@viblo
Copy link
Owner Author

viblo commented Oct 4, 2013

From vb%viblo...@gtempaccount.com on March 20, 2011 10:08:37

Thank you for the bug report!

As soon as you change the position of a static shape after it has been added to the space you have to call the Space.rehash_static() method. As the shape is static chipmunk (and therefore pymunk) believes that it wont move, and as a result doesnt update its internal collision structure with the new position.

The reason why this is not done automatically is to optimize the static shapes.. and if you for example change the position of many static shapes, you only need to do the rehash call once after all of them are moved.

If you intend to move around the shape, just add it with the normal add() method instead.

(I found another bug while researching this report, point_query did not work correctly with static shapes. That bug has now been fixed in latest trunk)

Status: Invalid
Owner: vb%viblo...@gtempaccount.com

@viblo viblo closed this as completed Oct 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant