Quick help with physics.RopeJoint
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Quick help with physics.RopeJoint
I've just started working with Box2d as opposed to rolling my own physics engine and I've run into a slight problem. I'd like to use the RopeJoint class, but I can't figure out what to pass for x1, y1, x2, y2, or maxLength as arguments to love.physics.newRopeJoint. Are x1, x2, etc. in local or world coordinates? Is ( x1, y1 ) the position of the anchor on body1? is maxLength in "pixels" or meters? I've been trying everything I can think of but I can't seem to get a functional RopeJoint. A more detailed explanation of the arguments would be hugely appreciated, or a simple working demo would be even better if anyone is willing to take the time. Thank you!
Re: Quick help with physics.RopeJoint
Unless it's different from a distancejoint the coordinates are world coordinates and the maxlength is in pixels.
Re: Quick help with physics.RopeJoint
Thanks for the reply. That didn't seem to work when I tried it that way, so I must be doing something else wrong. When I get home from work soon I'll post a quick example of what I tried.
- The Burrito
- Party member
- Posts: 153
- Joined: Mon Sep 21, 2009 12:14 am
- Contact:
Re: Quick help with physics.RopeJoint
This is 0.8.0 right? I had a working rope joint demo in January but I just tried to load it up and the rope segments fall away as if they aren't connected. When I had it working it looks like I was using local points, which would make more sense IMO but I feel like they're supposed to be world coordinates. The first coord is the anchor for the first body, second for second body. Pretty sure everything is in pixels now.
The only update since then that would've affected ropes directly that I can see is this: https://bitbucket.org/rude/love/changeset/2f56e709d4d1
But a lot of tweaks and fixes were made in February so it could have something to do with the fixtures / bodies themselves and not the joints.
I'm curious about this too, ropes are a lot of fun.
The only update since then that would've affected ropes directly that I can see is this: https://bitbucket.org/rude/love/changeset/2f56e709d4d1
But a lot of tweaks and fixes were made in February so it could have something to do with the fixtures / bodies themselves and not the joints.
I'm curious about this too, ropes are a lot of fun.
Re: Quick help with physics.RopeJoint
Yep, 0.8.0. I'm experienceing what you describe, however depending on what I set maxLength to sometimes weird glitches will occur (such as the objects teleporting around and suddenly changing velocity. Certainly not what you'd expect from a ropeJoint i.e. ).
I have attached a simple .love: which shows a DistanceJoint working as expected, a RopeJoint using nearly identical data yet behaving much differently, and the same objects without any joint at all (might as well be scientific
). On both Linux and Windows with Love 0.8.0 it appears to behave identically. Any idea what is causing the unexpected behavior from the RopeJoint?
I have attached a simple .love: which shows a DistanceJoint working as expected, a RopeJoint using nearly identical data yet behaving much differently, and the same objects without any joint at all (might as well be scientific
![Mega Grin :megagrin:](./images/smilies/ms-megagrin.png)
Re: Quick help with physics.RopeJoint
Ooh, apparently the x1,y1,x2,y2 coordinates are scaled twice or something (bug?)? I multiplied all the coordinates except the maxDistance by the value of setMeter and it works! Science!
Re: Quick help with physics.RopeJoint
Yep, looks like that's it! Interesting, in the changeset The Burrito posted, it seems that the signature for Physics::scaleDown changed from accepting a b2Vec2 to accepting two seperate ints; maybe the bug was introduced somewhere in that change? Wonder if this is affecting any other love.physics functions?
And now, I get to make the lovely (no pun intended) decision between a) adjusting for the bug and having my code break at an unspecified point in the future and b) simply not using any RopeJoints until the next release...
And now, I get to make the lovely (no pun intended) decision between a) adjusting for the bug and having my code break at an unspecified point in the future and b) simply not using any RopeJoints until the next release...
Re: Quick help with physics.RopeJoint
I used 2 distance joints instead for my project before love 0.8, functions the same and you can always add more if you want the rope to look prettier.
Who is online
Users browsing this forum: Ahrefs [Bot], Preblox and 5 guests