Search Unity

simple roll a ball game - ball slips threw ground

Discussion in 'Physics' started by Der_Kevin, Dec 15, 2015.

  1. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey folks. so iam working on this game:



    and its almost done. but i have one last bug left:


    as you can see, the ball is slipping threw the plane. i think its related to my global gravity setting. its Y: -600 but when i change it to something more normal like -10. the ball is just super slow or dosent move at all anymore?
    the rigidbody of the ball is:
    mass: 20
    Drag: 0
    Angular Drag: 0,05
    and use gravity

    the plane has a boxcollider with a thickness of Y:2. but also change this to 20 or more doesn't solved the problem.

    the ball has not movement script. its just a rigidbody. but the ground gets tilted based on where you click
    Code (CSharp):
    1.  if (Input.GetMouseButton(0)) {
    2.              RaycastHit hit;
    3.              Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    4.              if (Physics.Raycast(ray, out hit, mask.value))
    5.                  if (hit.rigidbody != null)
    6.                      hit.rigidbody.AddForceAtPosition(ray.direction * pokeForce, hit.point);
    7.            
    8.            
    9.          }
    but also changing these values to something like mass 200 or 2 doesn't give me the same grip anymore. does anybody have an idea whats wrong?