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)
- 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
- Can not set max_force od pymunk.constraints.DampedRotarySpring HOT 9
- Faster way for getting Polygon vertices in world coordinates HOT 3
- Batch api for applying impulse HOT 9
- How to get the net force from a set of collisions HOT 4
- `Space` may wrongly get unlocked during `step()` HOT 2
- RuntimeError when using `.remove()` in `separate` in very uncommon circumstances HOT 8
- lack of a method to create an aproximated disk (polygon) HOT 5
- Segmentation fault when setting `body_type` to dynamic HOT 1
- Body.sleep doesn't seem to work properly HOT 4
- Different segment orientations cause BB.segment_query to return different results
- How is ContactPoint.distance calculated? HOT 4
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.