[Solved]Pinning with Physics

  • Here's a doooosey,

    Is it possible to have two sprites with physics behaviors and bounding box collision pinned to each other. I did a simple test with two squares, added pin behavior and physics behaviors. Then did

    System-On start of layout->Sprite1 Pin pin to Sprite2.

    When I launch the preview, they both for a split second are together then bounce apart next to each other then fall at the same rate to the floor.

    My mind is guessing to some how put in a condition where either the physics or the collision is disabled and then triggered on when needed but I could use a point in the correct direction on on just getting them to stick together lol.

    I tried to check the Pin section of the manual but it was a little bare :)

  • I suggest you to read again the Basic physic tutorial especially the note about manual movement & other behaviors.

    Pinning two physic objects to each other (knowing that they'll automaticly push out from each other) is to be considered as irrealistic behavior.

    You should rather consider making a distance or revolute joint (Advanced physic tutorial).

    With such sensible/experimental (the plugin is still to be considered beta) topic as physics I recommand to read both tutorials and the future manual entry (not written at the date of this post, but it should be a matter of days/weeks at this point) often to refresh one memory.

  • I think I have a work around, and a logical one at that. If I have both object's pinned, both having physics is pointless. So I removed physics from sprite2 and on sprite2 I just used Set position to sprite1.x and sprite1.y. Now I just have to find a way to trigger physics onto sprite2y when needed.

    I created a group called together and set it active on start.

    Pinned one sprite to the other and when they collide with trigger, group is disabled and reaction occurs.

  • What are you exactly trying to archive? I've been useing a similar technique within my Pinball Demo

  • Pilot in a plane, when plane falls below certain height on the screen, pilot bails out.

  • Just destroy the 'pilotInPlane' Sprite and spawn a new 'PilotOut' sprite with physics.

    Game programming often requires some tricks (:

    In the end that's what the player sees that matters.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Mmmm that's a good idea!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)