Search Unity

Rigidbody velocity and forces

Discussion in 'Scripting' started by jimma, Sep 8, 2013.

  1. jimma

    jimma

    Joined:
    Apr 3, 2013
    Posts:
    28
    Hello,

    I am trying to move my camera with a rigidbody and box collider attached.

    I move my camera using rigidbody.velocity. But when my camera collides with an object there is some kind of a reaction force applied and my camera starts moving in all kinds of weird directions.

    Can someone please suggest whats going on here?

    Thanks!
     
  2. foxter888

    foxter888

    Joined:
    May 3, 2010
    Posts:
    530
    if you use velocity to move it is like pushing a bullet, so yeah it could be quick and most likely get some weird results, use the addforce function for that purpose and add torque for rotations and make sure your rigidbody code is on the fixed update since that's is what that update is for other than that you cohuld try the relative ones too. just experiment with it.