When making weldjoints between objects, they act very springy and not at all 'as one body,' like you'd expect welded joints to be.
Here's a GIF to show what I mean:
I know this can be avoided with some combination of DampingRatio and Frequency settings, but I can't seem to find a good spot between "way too springy" and "uncontrollable spinning mess."
(Sorry the image is so big, can't seem to resize it with BBCode )
EDIT: Solved using pgimeno's solution, thanks for the help!
How to avoid "springy-ness" with WeldJoints? [SOLVED]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to avoid "springy-ness" with WeldJoints? [SOLVED]
Last edited by iimurpyh on Tue Feb 11, 2020 10:15 pm, edited 1 time in total.
Re: How to avoid "springy-ness" with WeldJoints?
To make them act as one body, make them actually one body (by attaching the fixture to a single body) or, if you won't move them at all, make them static.
Re: How to avoid "springy-ness" with WeldJoints?
It seems like setting one object's body to the other object's causes the first to teleport to the second's center. How should I avoid this?
Edit: Seems like it's actually an issue with the way I'm drawing the objects, I've been using the position/rotation of each object's body, and since there are two fixtures under one body it draws both as being in the same position. There's no way to get the position or rotation of an individual fixture, though...
Edit 2: You can do some math depending on the shape of the fixture to get it's position/rotation, so that's what I ended up doing to fix the draw issue.
Last edited by iimurpyh on Tue Feb 11, 2020 10:16 pm, edited 1 time in total.
Re: How to avoid "springy-ness" with WeldJoints?
That depends on the shape. For polygon shapes, you need to offset every vertex. Use body:getLocalPoint on the original body's position to determine the offset to apply to each vertex.
I can't give any better advice without seeing some code, sorry.
Edit: It seems it's not possible to edit the shape's points, therefore both fixture and shape need to be recreated.
Edit2: Proof of concept attached (press space to fuse the objects). debugWorldDraw is by forum member Azhukar, modified by me to run on 11.x.
- Attachments
-
- fuseObjects.love
- (1.83 KiB) Downloaded 194 times
Who is online
Users browsing this forum: Bing [Bot] and 1 guest