Physics. Constraining to one axis?

0 favourites
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Well, I gave some examples earlier. It's a pretty standard part of any physics system.

    And in fact Box2D supports this type of constraint - it's called a Prismatic Joint. And it's section 8.7 of the manual

    ASHLEY. Any chance we could get these added to the physics? And the other joints? Moar physics!

  • From a brute force perspective you could use other physics objects to constrain the single axis object.

    For you scales example you could have the scale (...) holdy-thing (Brain block!) sandwiched between two immovable and invisible physics objects, similar to a chute or vertical tunnel, and using events disable collisions between these constraints and every other object except the scale.

    Could the clamp feature be of any use here? I'm a bit miffed on how the feature works but I've used it to constrain an object to an axis before.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK. I have kind of done it. Not quite as clamped as I would like but still not bad.

    Pick up the pink blocks and use them to play around with the blue platform. There is some physics wonkiness - but part of it is to do with combining physics with drag 'n' drop which is never a good idea.

    Basically this is achieved in a single line of code! Every tick, a force is applied proportional to the distance away from the target Y. This creates a spring effect and if you make the force large then the spring is pretty strong. Note that the spring is easily able to cope with gravity.

    Better results could be achieved by balancing density, force strength, linear damping.

    So the first rule of game physics applies: do everything with forces.

  • In fact, setting linear damping to 1 gives much more stability.

  • Jase00 - Cool - well that's definitely working better. Though I'm not quite sure why.

    You would have thought the velocity would override the Force or vice versa. But it just seems to be providing some extra damping - any idea why?

    And thanks.

  • Hi there,

    Got the same problem to simulate an anchored ship on a loading bay.

    Set.X is useless and buggy so i'm looking for something similar to the last 2 examples you guys uploaded.

    In fact I dont understand why the global value FORCE is set at -500, it doesnt seem to work on my project ...

    I think there is a way to make the Sprite.X-Initial.X equal to 0 so the boat wont move horizontally but I have no clue on how to do this for the moment.

    Any idea ?

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