Search Unity

Ball falls through plattform when the platform is to fast - see properties screenshot

Discussion in 'Scripting' started by wandern3D, Oct 15, 2013.

  1. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi,
    the ball bounces on the platform, so first all is OK
    I can turn the platform with the mouse, so the ball can change the direction, very fine to that time.

    But when Iturn the platform to fast, the ball falls through the platform.
    So thats the point why I can't figure out why this happens.

    In the attachements you can see the properties of the ball and the platform.
    So what is my mistake?
     

    Attached Files:

  2. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    set collision detection to continous (or similar)
     
  3. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi zeblote,
    I tryed "Continous" and "Continous dynamic" on the platform but its all the same.

    I make a good picture where you can see that the ball is half in the platform.
    The platform itself is a cube.

    other idears???
     

    Attached Files:

  4. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    Increase the Collider size at list by 2x times. this will fix the issue.
     
  5. abgamers

    abgamers

    Joined:
    Dec 22, 2009
    Posts:
    97
    Also try to changing the min penetration value. you will find this setting in
    Edit->Project Setting->Physics


    $Screen Shot 2013-10-15 at 9.42.58 PM.png

    Hope this solves your problem. :)

    Regards,
     
  6. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi abgamers,
    it goes but if I am really fast in turnung the platform the ball sticks a little bit at the platform.
    DRAG and ANGULAR DRAG ist set to ZERO (at Ball and at Platform)

    I thought that when I turn the platform and I hit the ball, that the ball jumps higher,
    but the ball doesn't. Can the Physicengine of UNITY do this from itself or should
    I make this by script?

    Its like playing table tennis where I give the ball additional speed
     
  7. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    How are you turning the platform? Are you using joints and applying torque, or do you just change its rotation?
     
  8. Marsupilami

    Marsupilami

    Joined:
    Sep 22, 2013
    Posts:
    21
    I'm guessing just rotation, because if you apply torque or force to move and object Unity seems to handle these high speed collision situations a lot better. I think Unity physics looks ahead for future collisions using the forces that have been applied to an object. This is why changing collision to "Continous" or "Continous Dynamic" didn't seem to help him.

    Don't necessarily need to use a joint as the appropriate axis can be frozen on the paddle's rigid body options. Assuming central pivot point and paddle made from a primitive cube freezing xyz positions and freezing the 2 axis that are not being used you can create a spinning paddle.

    As far as speed affecting collision response, I think adding torque instead of manual rotation will fix this problem as well.
     
    Last edited: Oct 16, 2013
  9. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
  10. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    I rotate the platform like this:

    Code (csharp):
    1.     void Update(){
    2.  
    3.  
    4.  
    5.         transform.localEulerAngles += new Vector3 (Input.GetAxis("Mouse Y") * MouseSensitivityY, 0, 0);
    6.  
    7.  
    8.  
    9.     }
    No sript at all nothing to the ball than to the platform.

    I played aroung the Physics Manager but no solution. Ball falls through if i rotate the platform to fast.
    The other link from JamesLee : Sorry I don't understand what you mean.
     
  11. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Is your platform kinematic? (its a rigidbody setting)... if not, the code you are using to move your platform is wrong.


    What exactly dont you understand?
     
  12. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi JamesLee,
    yes its kinematic see screenshots I attached

    The min Penetration Penalty = 0.001 helps a little but as I say If I turn the platform really fast, the balls goes through the platform.
    Also I thought that if I hit the ball with platform, the ball gets more speed.

    I don't understand what the Time Manager should help to solve this problem, cause if I read this I think this depence on the speed of the computer. But this should also functioned on a slower PC. I am a newbee in UNITY.
     

    Attached Files:

  13. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    if you make the timestep smaller, it recalculates the physics faster. for a simple game like this it shouldnt make too larger impact on performance.

    try increasing the solver iteration to 7

    if neither of these work you could try not making the platform kinematic and moving it with torque.
     
  14. wandern3D

    wandern3D

    Joined:
    Oct 13, 2013
    Posts:
    64
    If I try this with torque: I should write a script.

    Do you have a good tut that explanes torque in an comprehensible way?
     
  15. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
  16. cjow

    cjow

    Joined:
    Feb 29, 2012
    Posts:
    132