Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Weld joint problem — Gideros Forum

Weld joint problem

cvieiracvieira Member
edited August 2012 in General questions
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

  • ar2rsawseenar2rsawseen Maintainer
    edited August 2012 Accepted Answer
    Hello,

    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
  • Since the only problem seems to be one object may be slightly inside the other when a collision is detected... maybe where you handle the collision you can check the bounds and manually shift it outside of the body it hit before creating the joint.
  • Hi, thanks for your replies!

    @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
  • Hi, unfortunately setting bodies with "bullet = true" did not solve the problem... immediate resolution is forcing correct bodies position after the hit...

    Any ideias why bullet = true does not work as expected in this case?

    Thanks + Regards,
  • Hi @ar2rsawseen, after all bullet = true works like expected :) my mistake... inadvertedly i've set bullet = true on body fixture instead of body definition, like it should be! ;)

    Thanks again...
    +1 -1 (+2 / -0 )Share on Facebook
  • Love when people get back and give feedback on correct solution. It'll help other, with the same problems to find right solution faster ;)

    Likes: atilim

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.