Search Unity

Physics behavior of force applied to a rolling bal

Discussion in 'Getting Started' started by neutrino353, Sep 25, 2015.

  1. neutrino353

    neutrino353

    Joined:
    Sep 10, 2015
    Posts:
    15
    As a newbie to Unity. I've just follow the tutorial to write a tiny testing program that a rigid body sphere rolls on a plane when force are applied by pressing the arrow key.
    I've log the velocity of the ball on every frame after force are applied.
    There is one strange things I've noticed.

    If I press the arrow key in very short time (therefore applying a very small force for a very short time) and release it. The ball continues to accelerates in the time frames where no force is applied. This will continue for about 5 seconds until the velocity keep constant (I've attached a console log file in log_abnormal.txt)

    If I press the arrow key for longer time (say > 0,5 second), the behavior is normal (i.e. the velocity will keep
    constant when no force is applied), as shown in the attached log_normal.txt.

    If this a normal behavior of the Unity Physics engine or I've set anything wrong ?

    (I try to attached the whole project in this post, but is rejected because the file size is too large)
     

    Attached Files:

  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This the roll a ball tutorial? I think you'll find the default axis setup isn't decaying very quickly. Trend Input.GetAxis("Horizontal") and compare.

    If trending data is something you do a lot of you might be interested in a tool I put together. The latest version has been updated by a few other community members as well, so it should be pretty versatile.

    https://bitbucket.org/BoredMormon/trend.me
     
  3. neutrino353

    neutrino353

    Joined:
    Sep 10, 2015
    Posts:
    15
    BoredMormon

    your trending tools may be useful as I dig deeper into the Unity3d platform. In the current case, it should be enough to just use the Debug.log. What I am doing and investigating is rather simple :-

    I just build a simple testing game based on the "Roll a ball" tutorial that :
    a rigid body sphere is sit on a horizontal plane with high coefficient of friction to ensure rolling motion.
    a force is applied to the sphere for a short time, then removed.

    what i expected , according to my physics knowledge is that the sphere will accelerate until the
    force is removed. it will then either keep in constant velocity (both linear and angular) or
    decelerate if rolling friction or angular drags are defined.

    What confuse me is that if the period that that force is applied is very short (about 3 frame , i.e. 0.06 second),
    the sphere keep accelerate( both the angular and linear speed is increasing) for several seconds after the force is removed.

    I just want to figure out whether :-

    1) I've done anything wrong in setting up the testing game or
    2) There is some limitation in the Unity physics engine , especially in very small force and slow motion or
    3) My physics knowledge is wrong


    I've just done more experiment and got the following finding:-

    If I applied a physics material to both the sphere and the plane,
    The problem remains if the friction is set to 1 but DISAPPEAR if set to 0.