Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    899
    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.