Comments (2)
The reason why it happens is that the bricks doesnt have any mass or moment set. Objects without mass (or with infinite mass) behave very strangely, just as you could imagine a 0 mass object would in real life :)
To fix it I suggest you set a mass on the brick_shape shape. For example brick_shape.mass = 1
. http://www.pymunk.org/en/latest/pymunk.html#pymunk.Body.__init__
This is also the reason why I havent tried so hard to fix the NaN drawing issue, since its a very good indication of something bad/strange happening, and just hiding the error would likely lead to an even more difficult to understand error a little later.
Since you are not the first one to experience this I wonder if I should add a better error text or even outright preventing 0 or inf mass of objects added to a space.
from pymunk.
That fixes this. Thank you @viblo for the explanation and fix: Aww yiss, massless physics. !Noob alert! I'll be happily using debug_draw
shortly.
Re future: perhaps "Does Shape have a reasonable mass?"
+ the prior ValueError exception message? Adding guidance text to the current ValueError could be useful for a noob like me. This usage-error occurred when I naively, trivially set a KINEMATIC to be DYNAMIC.
Q: Where would you prefer it to be in the call-stack? ext_cpSpaceDebugDrawPolygonImpl
? According to comments on StackOverflow, an untriggered try:
is low-cost, performance wise.
from pymunk.
Related Issues (20)
- 3.11 wheels HOT 2
- pyglet_util debug_draw pyglet 2.0 compatibility
- pyglet_util debug_draw pyglet 2.0 compatibility HOT 1
- KeyError: using_sprites_pyglet: 'pymunk_logo_googlecode.png' HOT 3
- pypi page example throwing Python-CFFI error and not terminating HOT 2
- matplotlib_util_demo.ipynb does not work HOT 3
- Space.debug_draw for off-screen Circle erroneously draws as full-width streaks HOT 6
- Reading Force and Torque HOT 2
- Pymunk: Issue with Removing Constraints from Body HOT 3
- Body or shape identification in collision handler callback HOT 2
- Moving too fast leads to a series of problems such as through walls HOT 1
- How to create a customized joint? HOT 13
- c
- Memory leak with cpSpaceGetBodyPositions? HOT 11
- Body.copy() raising AttributeError HOT 2
- Add constraint between two static bodies which are later changed to dynamic does not work HOT 1
- Batch module HOT 3
- Body.copy() with multiple shapes attached to a body HOT 4
- The collision between two segments HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymunk.