Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Player going upwards when ataching 2Drigidbody

Discussion in '2D' started by Thegusse, Nov 13, 2013.

  1. Thegusse

    Thegusse

    Joined:
    Nov 29, 2012
    Posts:
    49
    Hello there

    Is 2D rigidbody physics-based movement the best way to control my character? I found that I couldn't attach a character controller, so I'm figuring that I have to use the rigidbody for stuff like simple movement (going from side to side and jumping).

    Thanks.
     
    Last edited: Nov 13, 2013
  2. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    731
    Yes, rigidbody2d and using velocities or forces should yield the results you need. See the 2D platformer demo for guidance. The 'CharacterController' component is specifically for 3D and works with PhysX (our 3D Physics engine) rather than Box2D (our 2D physics engine), so isn't of use. We have a Capsule shaped collider coming for 2D in a later version of Unity, but for now just use a circle at the feet and a box for the body area.
     
  3. Naboo

    Naboo

    Joined:
    Nov 13, 2013
    Posts:
    1
    I have a similar problem described in the title of this thread. When I create a new animation from two sprites and attach a 2DRigidbody, the object drops down on the Y a little bit and appears to creep up slowly. I expect the animating object to just fall on the Y axis with the 2DRigidbody attached. Thoughts?
     
  4. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    731
    Did you uncheck Animate Root Motion, and check Animate Physics?
     
  5. Thegusse

    Thegusse

    Joined:
    Nov 29, 2012
    Posts:
    49
    Alright, thanks for the clarification.

    @Naboo unchecking Animate Root Motion did the trick for me like Will suggested.