Incorrect connection of body settings in the physics engine

Hello! I am making a game of golf using a physics engine. I have a problem. I wrote a condition that when it hits the sand, the ball’s buoyancy is turned off. This is triggered if the ball hits the sand from the sand. If the ball hits the sand from another surface, then it bounces and the condition is not met.

I could be wrong but in testing, it seems like by the time the ball collides, it’s too late to change the restitution. It didn’t seem to switch back for the grass after the first hit either. You might need to either use a different parameter or something to detect the ground earlier. I tried a short ray cast (100 is probably too far) and it seems to work.

1 Like

Yes, I had an idea about the collision detection delay. Instead of defining a collision, I used the “distance between two objects” condition. But for some reason it didn’t work. Your way works great. Many thanks for the help! I see that you know the program very well.

1 Like

You’re welcome. There are aspects that I’m really good at. Others not so much. I’ve played around with programming my whole life as a hobby. Having knowledge in varying amounts of different languages helps. I still have a lot to learn.