How to make a springy wobbler?

0 favourites
  • 7 posts
  • This wobbler should... wobble and also stretch by centrifugal force, but tend to return to its initial angle, length and curve, like a spring does. Is the physics the only way?

    I'm able to create a straight "line" from sprites with physics, that behave pretty much like this, but I can't realize how to give a proper angle to each piece, so they will form a curve line like on the image "at rest".

    The second problem is I'd like only the load-tip (a ball on the wobbler's end) to collide with other objects, but not the wobbler's "line" itself, collisions should be disabled for the "line" - and that seems impossible using physics?

  • Is there any game with such a thing?

    If you did it straight, then just do it curved. Place multiple sections down, each angled a bit more, then create the joints.

    Look again at the actions of the physics behavior. You can disable physics collisions between objects.

    Or you could just have the end have physics with a spring joint moving it back into place and have the the rest just be sprites without physics positioned in a curve with qarp() or something.

    I don’t even know if the physics behavior has a spring joint. Anyways you could do a spring by constantly applying a force toward a rest position.

    ForceX = -k*(self.x-restx)/dt-b*self.velocityX

    And the same for y force, just with y stuff. K and b are the spring stiffness and damping. Usually in the range of 0 to 1 but you’ll just have to fiddle with it. Probably will want to put that under a condition of dt>0 since dt can be 0 which would give infinite force.

  • Thanks, R0J0! I'm trying to do it with Canvas instead :))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, R0J0! I'm trying to do it with Canvas instead :))

    I used a canvas layer for the baskets in:

    https://www.flippeeball.com

    The sides of the nets are each made up of three line-shaped sprites connected with revolute joints. The "knots" of the net are all sprites too and they're all connected up with distance joints - but distance joints are invisible so I draw between the knots using the canvas layer.

    As for your problem, I think this might work: make the spring from several segments connected with revolute joints. Then have two immovable/invisible sprites - one above the end of the spring and one below. Then attach distance joints from each to the tip of the spring. Actually, I think you might need a third - to the right of the spring's tip - to hold it taut.

    EDIT: Just realised that I don't think my solution will make the spring bend in a curve. Maybe you need multiple distance joints above and below. Or maybe you've solved it by drawing a curve that's not actually represented by a physics object.

  • You can make a curved wobbler by connecting small parts with joints and using distance joints to control the stretch. For the curve, you can use the Canvas to draw it without depending too much on physics. To fix collision issues, you can turn off collisions for some parts in the physics settings.

  • Here's a few ideas.

    First idea is to use two distance joints. One from the end to the base, and one end to the end position. The curve is then purely decorative. I just placed a series of sprites in a curve with the qarp expression. Using a DrawingCanvas or a distort mesh are also options.

    dropbox.com/scl/fi/8zpim87vy5dtsv3i1snj8/wobbler.c3p

    Second idea is to position the pieces in a curve and connect them with limited revolute joints. I first tried starting them in a straight line and making it curve by adjusting the limit angles. The physics behavior didn't like that much so the curve was looking kinked. I then just positioned the pieces in a curve before adding the joints which was better. To help it support it's own weight I made the mass less toward the end.

    dropbox.com/scl/fi/iql8dep887mag2122mkpa/wobbler2.c3p

  • Wow, thank you all guys!

    R0J0hound special thanks! I like your approach in the first example.

    I'll be back if I get the desired effect with Canvas too, but if not, I'll probably use your approach #1 with a little tweak allowing it to stretch by its axis.

    Happy New Year! :)

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