Mini golf sand

0 favourites
  • 6 posts
  • Hi there,

    I'm making a little mini golf prototype and have run into a small problem that I could use some help with.

    Basically I have a ball with the physics behaviour (with gravity set to zero), and I'm using forces to push the ball around.

    That part works great.

    Now I would like to add a sand trap. So when the ball goes over it, it slows down.

    I've tried a bunch of things, but can't seem to get this to work.

    Any suggestions for a simple way to achieve this?

    Thanks a bunch!

  • setting the friction of the ball while it is on sand (or speed/acceleration, increasing de-acceleration), or setting the friction of the sand object itself if the ball passes over it.

  • A quick way to do this is to set up an invisible collision tester that sits over the sand trap. Whenever the ball is within that tester, set its linear damping to something quite high, like 5. When it's not within the tester, set it back to its original value.

    example capx

  • Thanks for the tips and example. Much appreciated.

    I forgot to mention that it's a top down viewpoint. And changing the linear damping doesn't seem to make any difference for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem, I've updated my above capx to have a top-down perspective. Click on the ball to fire it off in a random direction. It'll slow down when it's over a sand trap.

    Linear damping does work. If you're not getting it right then check my file for the correct way to implement it.

  • Ah, I see what I'd done wrong.

    I had accidentally disabled the, 'is overlapping sand' part instead of inverting it. That's what was causing the problems.

    Thanks heaps for your help!

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