velocity affect formula of drag object and friction

General Box2D issues or C++ specific issues
immeasurability
Posts: 1
Joined: Tue Mar 29, 2016 6:44 am

velocity affect formula of drag object and friction

Hi all!!!
Example #1
i have physics object
object have velocity Vector2(1,0)==Vector2.Right
object have drag=1 point (this meen what he must to slow down)
object dont have friction
object gravity no

what formula do that??? that affect the final result?

1 frame(time:0)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

2 farme(time:0.02)(Time.fixedDeltaTime=0.02)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0.9803922,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

Example #2
i have physics object
object have velocity Vector2(1,0)==Vector2.Right
object have drag=0 point (this meen what he must to slow down)
object have friction=0.4
object gravity standart

what formula do that??? that affect the final result?

1 frame(time:0)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

2 farme(time:0.02)(Time.fixedDeltaTime=0.02)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0.92152,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

Example #3
i have physics object
object have velocity Vector2(1,0)==Vector2.Right
object have drag=1 point (this meen what he must to slow down)
object have friction=0.4
object gravity standart

what formula do that??? that affect the final result?

1 frame(time:0)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

2 farme(time:0.02)(Time.fixedDeltaTime=0.02)
object.velocity*=???
Debug.Log(object.velocity)==Vector2(0.903451,0)
object.velocity=Vector2.right
Debug.Log(object.velocity)==Vector2(1,0)

-----------------------------------------------------------------------------

i work in unity3D 5
my code lang C#

i need this to can drag in my game object to controll my player
my player apply force on draggable object (box) and i need to cnow what force to add to player to synchronize speed of player and box

for Unity3D Rigidbody i cnow formula! but this not work on Rigidbody2D (Box2D)
of 3D final result for drag is velocity*=Mathf.Clamp01(1f - drag * Time.fixedDeltaTime); and max drag in 50 limit (if set darg of 50 to object then velocity=0 all time)

in Box2D the drag formula dont have limit
in forum of unity3d suport get me link https://github.com/erincatto/Box2D/blob ... Solver.cpp
but i bad cnow this structure of lang and dont see what i need(

help me pls

sorry for my english