Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Moving Plattform Script

Discussion in '2D' started by TheCheatsrichter, Jan 4, 2015.

  1. TheCheatsrichter

    TheCheatsrichter

    Joined:
    Jan 4, 2015
    Posts:
    1
    Hi,

    I wanted to make a script which moves an object in the X axis. However I can't get the Position of the Rigidbody.
    I googled and the Unity help told me that a "Rigidbody2D.position" does exist. However I can't get it working.

    Bild_06.png object.PNG
     

    Attached Files:

  2. wizardious

    wizardious

    Joined:
    Dec 31, 2009
    Posts:
    189
    Last edited: Jan 5, 2015
  3. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    891
    I think your problem is that you are mixing RigidBody2D and rigidBody2D. The first one is the class name and the second one refers to the rigid body 2D component. In your script you only want to use rigidBody2D all the time.