Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How do I make movement slow with drag on a rigidbody2d?

Discussion in 'Physics' started by JeremyToler, Oct 11, 2019 at 7:02 AM.

  1. JeremyToler

    JeremyToler

    Joined:
    Jul 11, 2015
    Posts:
    17
    I am remaking a game I made in 3D as a 2D game because it looks better that way, but I am having trouble getting the players to slow to a stop like they did in the 3D version. Here you can see the player just keeps moving after the initial force is added - https://imgur.com/a/DEWhvW6

    I'm adding force with the following cod:

    Code (CSharp):
    1. p1.obj.GetComponentInChildren<Rigidbody2D>().AddForce(p1.obj.GetComponentInChildren<Rigidbody2D>().transform.right * p1.charge, ForceMode2D.Impulse);
    I have tried adding ludicrous amount of drag but all it does is dampen the initial force, once the player starts moving they don't stop.
     
    Last edited: Oct 12, 2019 at 8:41 PM