Giter Club home page Giter Club logo

Comments (4)

jsanmiya avatar jsanmiya commented on May 22, 2024

Hi Martin, thanks for finding these!

b2Body.CreateFixtureFrom(Def|Shape) accesses a global variable called
world instead of the world the b2Body belongs to.
Can you please provide a file and line for this? Thanks!

Sometimes GetParticleCount is off by one
If you have test code that demonstrates this, that would be invaluable.
Indeed, I would gladly accept a pull request for a fix for this.

The position buffer is too small
A test case for this would be great too.

Thanks!
Jason

On Sun, Apr 12, 2015 at 2:18 AM, Martin Ziel [email protected]
wrote:

I found some problems with the existing bindings.

b2Body.CreateFixtureFrom(Def|Shape) accesses a global variable called
world instead of the world the b2Body belongs to.

The methods GetParticleCount/GetPositionBuffer don't work quite right.
Sometimes GetParticleCount is off by one, which might be because of the
int/double casting.
The position buffer is too small. It has the same size as the
numberGetParticleCount() returns, but should be twice as large. The current
bindings code seems to allocate the buffers correctly, but still results in
this problem while running the code. Unfortunately, I'm not so acquainted
with Emscripten so I can't figure out where the problem lies.


Reply to this email directly or view it on GitHub
#46.

from liquidfun.

zilluss avatar zilluss commented on May 22, 2024

The global world variabe is used at https://github.com/google/liquidfun/blob/master/liquidfun/Box2D/lfjs/jsBindings/Dynamics/b2Body.js#L113

I couldn't replicate the off-by-one error, but made a test case for the problem with GetParticleCount/GetPositionBuffer. The length of the PositionBuffer is equal to the ParticleCount but should be twice as large. After a single invocation of CreateParticle, GetParticleCount reports 2 existing particles, so it's also possible that too many particles are created. If you run the test case in the TestBed, you can see that roughly half of the particles are stuck in the air.

Here is the test case:
https://gist.github.com/zilluss/219a4c32feb59c3a0222

from liquidfun.

jsanmiya avatar jsanmiya commented on May 22, 2024

Thanks Martin.

Re: global world variable
The lfjs bindings currently assume that you have a world variable defined
in your code somewhere. You can see the Testbed for an example:

https://github.com/google/liquidfun/blob/master/liquidfun/Box2D/lfjs/testbed/testbed.js#L13
It's a limitation, as you point out. With the current setup, you can only
have one world. It would be nice to allow the interface to support multiple
worlds.

Re: length of PositionBuffer
Looks like you found a good bug. Can you please create an issue for it at
https://github.com/google/liquidfun/issues, and include your test case as
well?

Thanks!
Jason

On Wed, Apr 22, 2015 at 2:27 AM, Martin Ziel [email protected]
wrote:

The global world variabe is used at
https://github.com/google/liquidfun/blob/master/liquidfun/Box2D/lfjs/jsBindings/Dynamics/b2Body.js#L113

I couldn't replicate the off-by-one error, but made a test case for the
problem with GetParticleCount/GetPositionBuffer. The length of the
PositionBuffer is equal to the ParticleCount but should be twice as large.
After a single invocation of CreateParticle, GetParticleCount reports 2
existing particles, so it's also possible that too many particles are
created. If you run the test case in the TestBed, you can see that roughly
half of the particles are stuck in the air.

Here is the test case:
https://gist.github.com/zilluss/219a4c32feb59c3a0222


Reply to this email directly or view it on GitHub
#46 (comment).

from liquidfun.

zilluss avatar zilluss commented on May 22, 2024

I created a new issue for the ParticleCount bug in #50
#49 covers the problem with the global world variable.

from liquidfun.

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.