Page 1 of 1

Weld joints are buggy on 0.10.2 [SOLVED]

Posted: Mon Feb 13, 2017 4:53 pm
by Chroteus
EDIT: It seems it's a 0.10.2 specific bug, not OS-related bug.

I've found a quite peculiar bug that hopefully someone can help me with.

I have a level, made up of a bunch of rectangle bodies, joined by weld joints, and revolute joint in the middle. Weld joints are represented by red wiggly dots made very carefully in Paint :megagrin:.

Here's how it looks before level's physics are turned on:
no_physics.png
no_physics.png (433.86 KiB) Viewed 3509 times

Here's how it looks like after physics are turned on, on my Windows partition:
Untitled.png
Untitled.png (176.37 KiB) Viewed 3509 times

Here's how it looks on my Android tablet and my Arch partition:
Screenshot_2017-02-13-18-37-38.png
Screenshot_2017-02-13-18-37-38.png (488 KiB) Viewed 3509 times

As you can clearly see, the bodies on the edges collapse for some reason.

Re: Weld joints are buggy on 0.10.1 Linux/Android

Posted: Mon Feb 13, 2017 6:04 pm
by raidho36
That's queer, box2d has no platform-specific code. Can you post a minimal example that reproduces the problem?

Re: Weld joints are buggy on 0.10.1 Linux/Android

Posted: Mon Feb 13, 2017 6:48 pm
by s-ol
Also, can you print the dt's that go into world:update()?

You might be able to fix this by switching to a fixed-update love.run but if that's the case you will probably expose an underlying performance problem in your game.

Re: Weld joints are buggy on 0.10.1 Linux/Android

Posted: Mon Feb 13, 2017 7:54 pm
by airstruck
That last screenshot looks like the sort of thing that might have happened before reference angle was added to the weld joint constructor. Are you 100% sure these screenshots are all from the same version of Love?

Re: Weld joints are buggy on 0.10.1 Linux/Android

Posted: Tue Feb 14, 2017 12:16 pm
by Chroteus
airstruck wrote: Mon Feb 13, 2017 7:54 pm That last screenshot looks like the sort of thing that might have happened before reference angle was added to the weld joint constructor. Are you 100% sure these screenshots are all from the same version of Love?
That seems to be the cause. My Linux and Android version of Love was 0.10.2, which I did not notice. Now that I've upgraded Love on my Windows, same bug happens. I'll see if I can reproduce bug with a standalone simple program. Perhaps, it's just my game.

I misunderstood. It's not a bug. It's just that the angle of 0 rad is enforced between two bodies now (default values). Here's how my Weld joint initialization looks like now:

(anchor's positions are repeated, since I connect bodies in one point)

Code: Select all

joint = love.physics.newWeldJoint(bodies[1],bodies[2], x,y,x,y, false, bodies[2]:getAngle()-bodies[1]:getAngle())
Thanks for the tip, airstruck.