Search Unity

Moving in two dimensions in 3D game

Discussion in 'Scripting' started by Niesyto, Oct 25, 2014.

  1. Niesyto

    Niesyto

    Joined:
    Oct 25, 2014
    Posts:
    2
    Ok, i wanted to make script to make my character able to move only in 2D(x and y) but it have to be used on 3D game. The problem is that i'm really newbie in scripting and i don't really know how to do it. Tried to edit script made by friend he used in his 2D game. Not really working. I uploaded the script. Can anyone tell me why it's not working, and help me fix it?
     

    Attached Files:

  2. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    It probably does not work because you'll need a similar setup to your friends project in order to just use it in your project.
    I'd simply ask him to write an example for you. :) Basically, you'd simply need to keep your objects on the x/y plane and leave the z-component alone unless you really need it for some specific stuff.
     
  3. Niesyto

    Niesyto

    Joined:
    Oct 25, 2014
    Posts:
    2
    Ok, but i don't really know how to do it.
     
  4. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Have you tried to watch tutorials?
    You'll need this pretty often when working with Unity or any other engine, these are some of the basics when something shall move in your game so you might want to invest the time in order to understand how it works and to be able to re-produce it for any given situation in your further development.
     
  5. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    If you think you're going to be successful without studying 3D graphics theory, you're wrong. You NEED to learn about vector math, X,Y,Z axis, scale and rotation. These are not advanced topics. These are like learning your ABC's. It's like you're asking us how to spell "CAT".
     
    Suddoha likes this.