Giter Site home page Giter Site logo

Comments (2)

viblo avatar viblo commented on June 14, 2024 1

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.

nrichards avatar nrichards commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.