Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Make ball never stop rolling using physics

Discussion in 'Physics' started by isravle, Feb 22, 2021.

  1. isravle

    isravle

    Joined:
    Dec 27, 2020
    Posts:
    1
    Hey,

    I have a Ball with rigidbody component,
    During my game I need to let the ball to rolling and never stop until the game is end, and then I will destroy the object.


    I tried to add force using forward but its go to only one direction.

    Someone have any idea how to deal with it?
     
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    Try this in FixedUpdate:


    Code (CSharp):
    1. float targetSpeed = 5f;
    2. rb.velocity = rb.velocity.normalized * targetSpeed;