Mini golf sand

Get help using Construct 2

Post » Thu Jan 31, 2013 4:59 am

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!
B
10
S
4
G
5
Posts: 136
Reputation: 2,977

Post » Thu Jan 31, 2013 7:45 am

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.
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Thu Jan 31, 2013 7:52 am

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
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Thu Jan 31, 2013 8:35 am

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.
B
10
S
4
G
5
Posts: 136
Reputation: 2,977

Post » Thu Jan 31, 2013 9:45 am

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.
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Thu Jan 31, 2013 11:10 am

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!
B
10
S
4
G
5
Posts: 136
Reputation: 2,977


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests