Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[SOLVED DONT USE UNITY3D BOX2D] Physics2D velocity drag and friction affect factor

Discussion in 'Physics' started by immeasurability, Mar 25, 2016.

  1. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    ok...
    i have one moment of velocity

    1 - on scene circle collider with Rigidbody2D (constraints.freeze rotation.z)
    2 - and box collider2d ground

    1 and 2 dont have Physics material (by default friction==0.4f)

    1 - circle rigidbody.drag=0

    i set circle rigidbody.velocity to Vector2.right (x=1)

    Code (CSharp):
    1. void FixedUpdate () {
    2.     Debug.Log(this.GetComponent<Rigidbody2D>().velocity.x);
    3.    //in log velocity.x==0.92152f
    4.     this.GetComponent<Rigidbody2D>().velocity=Vector2.right;
    5. }
    what formula off do that? (velocity*(drag & friction & Time.fixedDeltaTime & more? ))=0.92152f
    how affect drag on velocity
    and how affect friction on velocity

    what i need to do? to get converted velocity!

    i examined of this http://forum.unity3d.com/threads/drag-factor-what-is-it.85504/
    and this http://forum.unity3d.com/threads/terminal-velocity.34667/

    but no one formula dont get my real velocity (from 1 to 0.92152f)
     
    Last edited: Mar 25, 2016
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
  3. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    No idea for 3D; you'd need to look at the PhyX source code. For 2D I have given you the answer above i.e. the source code.

    It's not a simple forumula as you are suggesting it is and cannot be reduced to one. It doesn't just modify the velocity either and depends on number of contact points, collision impulse, collision tangent, tangent mass etc.
     
  5. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    i cnow how to do this in RigidBody3D
    i ask for RigidBody2D, now i try to extract it from your source
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Pretty much all the physical simulation for 2D is from Box2D apart from some extra stuff such as buoyancy etc so yes, you should be able to get everything you need from there.
     
  7. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    wrong way
    on velocity operates two conditions of drag and friction
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    I don't follow what you mean here. Also, I don't follow the title of "[SOLVED DONT USE UNITY3D BOX2D]".

    Are you just realizing that there are two separate physics systems in Unity3D and you're surprised by the fact that they operate slightly differently?