Search Unity

RigidController Crazyness!

Discussion in 'Editor & General Support' started by nickavv, Sep 24, 2006.

  1. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    I coded up my own rigidbody based character controller. It's really simple, but I need some help. Basically Left and Right arrows rotate you and up adds relative forward force. So here's the problem. When you start running real fast and then turn, you're still sliding in the first direction you ran. Any way to cancel the force when you use the left and right arrows? Thanks!
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
  3. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Okay, if I'm going to be using that, then can I make the character rotate to face the direction he's walking. I'm pretty sure I asked this before and didn't get much in response other than the Non-Rigidbody Character Controller, which rotates with Left and Right and moves forward with up, which is not what I want. I tried putting objects on all sides of him and had him use transform.LookAt, but he looked sort of at an angle and it was really screwing up my collisions.
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You can rotate your character controller or rigidbody as you like, but you want to make sure you rotate only around the y-axis. If you have a human like character it's going to be a little weird if you tilt the capsule up and down.

    So you probably want to use something like this:

    Code (csharp):
    1.  
    2. var theDirectionYouWantToLook = ...;
    3. theDirectionYouWantToLook.y = 0;
    4. transform.rotation = Quaternion.LookRotation(theDirectionYouWantToLook);
    5.