Coder Social home page Coder Social logo

Box2D collision, broken about libgdx HOT 4 CLOSED

badlogic avatar badlogic commented on May 4, 2024
Box2D collision, broken

from libgdx.

Comments (4)

badlogic avatar badlogic commented on May 4, 2024

From badlogicgames on June 17, 2010 12:33:30

Ouch, mea culpa. Fixing. Fixed version will be released this weekend along with other fixes.

Status: Accepted
Owner: badlogicgames

from libgdx.

badlogic avatar badlogic commented on May 4, 2024

From badlogicgames on June 17, 2010 12:37:42

Hm, upon further inspection i'm not sure whether this is the correct fix. I implemented the Java side collision filter based on the original Box2D filter. Here's the corresponding method in the original:

// Return true if contact calculations should be performed between these two shapes.
// If you implement your own collision filter you may want to build from this implementation.
bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB)
{
const b2Filter& filterA = fixtureA->GetFilterData();
const b2Filter& filterB = fixtureB->GetFilterData();

    if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0)
    {
            return filterA.groupIndex > 0;
    }

    bool collide = (filterA.maskBits & filterB.categoryBits) != 0 && (filterA.categoryBits & filterB.maskBits) != 0;
    return collide;

}

which is exactly what i have in Java. I haven't played around with maskBits and categoryBits yet. Are you sure you are using them correctly?

from libgdx.

badlogic avatar badlogic commented on May 4, 2024

From [email protected] on June 17, 2010 13:44:15

I know nothing about Box2D, so wouldn't know what the maskBits and categoryBits refer to - I just made an edit that allowed me to keep coding for the time being ^_^

from libgdx.

badlogic avatar badlogic commented on May 4, 2024

From badlogicgames on June 17, 2010 15:08:25

Well, i can't reproduce the problem. I make this a Won't Fix as i'd rather stick with the original code of Box2D than just guestimating a quick hack :) If you have a test case for me to reproduce i'll reopen it.

Status: WontFix

from libgdx.

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.