Hi all,
I’m extremely new to Unity and have tried a lot of different things to do this, but most tutorials for beginners provide instructions on how to create things like rolling balls or moving characters that respond directly to character input (e.g. holding left makes the object move left for the amount of time you hold left for), and the documentation does not provide much help because I can’t find specific solutions or answers to problems. I do have a comprehensive understanding of C# and completed and understood tutorials on C# before heading over to Unity, but then I was unable to find Unity tutorials relevant or useful to me, because no tutorials I have found explicitly explain basic functions which can be used in Unity.
For the project that I’m making, I want the arrow keys to make objects move a predetermined amount. For example, pressing the left key once makes an object move left this many spaces.
For my specific project, which is in a 3D environment, I have 6 objects, located above each other. These objects are 2D images in a canvas which overlays the game camera as a UI. Imagine that object 1 is at the top, and object 6 is at the bottom. When the user presses the down key, I want object 1 to move to object 2, object 2 to move to object 3, and so on, to create a cycle through the objects. Object 6 would move out of the screen and reappear at the top.
I already understand how to get user inputs through using
if (Input.GetKeyDown(KeyCode.DownArrow))
However, if someone could please explain how to use Vector3 and transform.position, since I have searched forever but no place explains what they mean or how to use them, I would be extremely grateful. Also, I have not searched this, but as a side note, do things like transform.scale or transform.rotation also exist?
Sorry if this question is too long, or if I have used incorrect terminology, but here’s a summary of my questions. I’m finding it really difficult to get instructions for things I want to build, and I don’t want to sit through youtube tutorials that don’t explain how to script, or don’t provide a list of methods/functions and how to use them in Unity. I would prefer answers that are more general and explain things in detail, like a written tutorial. Also, when answering these questions, please be specifc in regards to what parameters are required, and what previous parts of code or objects you are referencing, because I find that a lot of tutorials don’t explain these basic things.
-
How can you store the position of an object as a variable?
-
How do you move an object to a predetermined position?
-
How do you move an object off-screen and make it reappear from the side of the screen?
-
What does transform.position do, and how do I use it?
I’m getting really frustrated because it’s difficult to find simple and useful explanations on how to use Unity. But thank you for reading through this question, and please give me answers (i need help)!