0
\$\begingroup\$

I am developing a simple Golf game as shown in the below image.

enter image description here

I am facing below issues:

  1. Even if I apply small amount of force, the ball continuous move along the grass? Grass friction is not stopping the ball.
  2. Sometimes, the ball speed is increased after colliding with the walls instead the ball speed should decreased after collision with the walls. The walls are having box collider.
  3. Sometimes, the ball reverses its direction after colliding with walls.

Code:

Physics properties of the ball:

 ball.physicsBody.affectedByGravity = true;
 ball.physicsBody.mass = 0.0450;
 ball.physicsBody.restitution = 0.8;
 ball.physicsBody.friction = 0.3;
 ball.physicsBody.allowsResting = true;

Physics properties of the grass:

golf.physicsBody.friction = 0.8;

Physics properties of the walls:

 leftWall.physicsBody.friction = 0;
 leftWall.physicsBody.restitution = 0.8;

I have set the physics world gravity value to -9.8.

I am looking for suggestions to fix the above listed issue. Thank you.

\$\endgroup\$
  • \$\begingroup\$ Isn't there a separate friction value for rolling? \$\endgroup\$ – Bálint Apr 13 '18 at 6:58
  • \$\begingroup\$ Yes. But should I apply that value to ball or the grass surface? \$\endgroup\$ – Nimesh Chandramaniya Apr 13 '18 at 8:02
  • \$\begingroup\$ apply it to the ball. \$\endgroup\$ – Bálint Apr 13 '18 at 8:18
  • \$\begingroup\$ Even if I increase the rolling friction to 0.8, the ball continues to move along grass surface. \$\endgroup\$ – Nimesh Chandramaniya Apr 13 '18 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.