Hi, i'm using weld joint with success but i'm having an issue that may be problematic to gameplay... i have bodies that can collide, and when they collide, they stick together... so, when there is a contact, i create a weldjoint. Till here no problem since the weldjoint is always created and works with no issue... the problem is that, sometimes, when bodies collide, one body is glued to the other but it stays a little inside the other (sometimes half a body)... i'm detecting contact when event onBeginContact occurs, where i'm setting a variable that is used on onEnterFrame, where i'm creating the weldjoint.
Can this be avoided? If not, there is any workaround to this issue?
Thanks!
Comments
Problem is probably due to one of the objects moving too fast
well have couple of ideas you can experiment with:
1. I don't remember if it's possible to create joins onBeginContact
2. There is another event PRE_SOLVE that you can try to use, I think it is used just before collision
3. Setting objects as bullets in body definition:
bullet: (boolean) Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies. Warning: You should use this flag sparingly since it increases processing time.
4. Use distance joint instead of weld join with a specific distance, which is a sum of both object radius
3rd and 4th solutions should work, but they have their disadvantages:
3rd - increased processing time (depends on how many bodies do you have)
4th - bodies will probably could rotate around each other and around their own center
@ar2rsawseen
1. It's not possible to create joints on onBeginContact
2. I've tried to use pre_solve already and with the same results... incredibly i've tested post_solve with better results thought
3. The bullet idea seems that can do the trick i will test and post the results later
@zvardin
i've tried your solution already and it works, but it cause some flickering effect that does is not neat... but if nothing else works i guess i have to use this or the 4th solution proposal from @ar2rsawseen
Thanks + Best Regards
Any ideias why bullet = true does not work as expected in this case?
Thanks + Regards,
Thanks again...
Likes: ar2rsawseen, atilim
Likes: atilim