Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Physics objects overlapping when jointed

Hello,

I've been using jointed physics objects in the past, but never noticed this: when I create physics polygons and then connect them with a distance joint, the object are attracted towards each other (which is normal), but then overlap as if contacts didn't apply anymore. I'm not sure if I'm clear, so I've done this video.

Any idea what could cause this problem?

Tagged:

Comments

  • dave1707dave1707 Mod
    Posts: 7,605

    @Rodolphe Anytime I have physics objects overlapping is when the physics object rotates but the visual image doesn't rotate properly to match it so the visual images overlap.

  • edited January 2015 Posts: 277

    Thanks Dave. It doesn't seem like this is my issue, but it's a good point. I'm investigating... :)

  • Posts: 1,595

    @Rodolphe this is normal, if you create a weld/rope/distance/slider etc the two bodies of that joint will stop colliding. I like this behaviour, but it would be nice to be able to make them collide. Because of this I'm using a ROPE joint with a length of math.huge to make objects not collide, so if this behaviour were to be fixed then it's best if it's optional to collide the two bodies.

  • dave1707dave1707 Mod
    Posts: 7,605

    @Rodolphe I think @Luatee is correct. I have a rope that I created with a lot of physics.body(Circle) linked together with joints. I can move the rope around in loops and make it overlap with itself. If the collision was in effect, then it wouldn't overlap.

  • Posts: 277

    Alright, that makes sense now! Joint objects not colliding with each other is quite problematic for what I'm trying to achieve though... Any advice on how to get around this would be appreciated! cheers!

  • dave1707dave1707 Mod
    Posts: 7,605

    @Rodolphe I wonder if there's a way to link none jointed objects to your jointed ones. That way, the none jointed objects will collide and stop the overlaps. But I'm not sure if that's possible.

  • Posts: 277

    That could work, but I'm trying to keep computation at a minimum, my ipad I struggling to compute the scene as it is right now

  • edited January 2015 Posts: 1,595

    @Rodolphe @dave1707 is probably right in his suggestion, I'd suggest you create two instances of the body, say a and b. Weld a to b, set b.sensor = true and that should work. If mass is an issue try to set b.mass = 0, that probably won't work with the joint though.

    Edit: Or axis a very small body to the center and use that as a body for the joint.

  • Posts: 277

    Thanks Luatee, trying your Edit piece right now.

  • Posts: 277

    Your suggestions worked, thanks a lot!!!

  • Posts: 1,595

    That's very well done @Rodolphe and exactly what I meant. Your game is coming along nicely :) But I still think this issue should be sorted out with an optional collide parameter with the joint, not sure if @Simeon or @John want to have a say in the matter.

  • Posts: 277

    Thanks! oh yes, I think we definitely need an option. this method works but it increases the number of joints and bodies by quite a lot (and we often need as much ressources as possible, I know I do)

  • Posts: 1,595

    Well if I were to do this in my game I'd only be allowed to have around 50 props with joints whereas now (on iPad Air) without having collision I can get up to 100 and still be on 60fps. I'm grasping at every single bit of memory I can get hands on, but some things aren't avoidable unlike this with such a big advantage.

Sign In or Register to comment.