Search Unity

right way to move a sphere

Discussion in 'Physics' started by whoseline, Oct 5, 2019.

  1. whoseline

    whoseline

    Joined:
    Dec 22, 2012
    Posts:
    11
    hi,
    I have a road and a ball (A). I've tried rigidbody AddForce, AddRelativeForce, useGravity = false etc.
    When the ball reaches that point(B) the road behaves like an obstacle and the ball can't go up higher.
    Anyone knows how to complete a full circle with rigidbody object? Thank you. Untitled-1.jpg
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    You should monitor the contact with the ground and apply the force perpendicularly to the contact normal.
     
    whoseline likes this.
  3. EliJNemer

    EliJNemer

    Joined:
    Aug 3, 2019
    Posts:
    123
    i agree with Edy..

    i have done some similar calculations.. it may look something like when ball is not on ramp , Cos = 1, if it is at the height of the radius Sin = 1, Cos = 0, at diameter cos = -1, sin = 0, and so on. this can be done using the inverse of cosine and sine, taking the ratio of the (ball position - radius)/radius getting a value between 1 and -1, this value is constantly updated, and thus using these rations multiplied by seperate force vectors.. AddForce(xRatio*Force, yRatio*Force, 0, etc..).. of coarse xRatio is connected to Cos value and Y value is connected to Sin Value you calculate..

    hope this helps..
     
    whoseline likes this.
  4. whoseline

    whoseline

    Joined:
    Dec 22, 2012
    Posts:
    11
    Thanks a lot Edy and EliJNemer. I was so lost about this. Thank you.
     
    EliJNemer likes this.