# move or transform.translate question

I may be completely overlooking the easy way of doing it, but I’m tossing a question out. Lets say you have an object that is just controlled on the x-axis through the Input.GetAxis(“Horizontal”) like a 2D game and you want to move that object on both the y and z axis. So for example you can run and jump in 2D, but you want to jump to a platform that sits back a bit on the z-axis. What is the best way of having the object ‘jump’ to the platform on the z-axis? Is it just a simple transform.Translate? Because when it’s moved the object should still just be controlled on the x-axis because of the horizontal controller. I didn’t know if there was a quick way to have it move up the y-axis a few units and then move back on the z-axis a few units.

No code to provide as of yet, I’m in the process of hammering out ideas.

Break it down to being a gamer… I hold the A key, I move left, D key, right. I press space, and it jumps a little (X and Y)… how do I control the Z? What keys? How does the player know he has to “Side Step” something?

Those fundamental questions are what you need to answer. If you wanted to add the Vertical controller to the Z, you could do it a couple of ways. The easiest would be to simply ramp a number from zero to one, and back or zero to negative one and back. The longer he holds the up key, the more towards one it goes. If he lets go of it, it ramps back to zero. This corresponds to his placement in Z space. He can still jump and move forward and back as well.

The angle I was going for is having the player move left, right on the x-axis and also just jump up in the air a little bit. Now I’ve got that down for sure, but the other thing I would be going for would be to have platforms higher up and set back a little on the z-axis so you would need to press up and jump to go higher and back to the platform. I just didn’t know if I should just have it go up so many units and then back a few to land on the platform. For instance is there a easy way to force the object to move up 3 units and then back 1 unit and play a jump animation so it would look like you jumped up higher and landed on the platform. I need it to be somewhat precise in the movements so that the character doesn’t fall off rather than land when they jump higher or drop down.

I’m probably over complicating things, I tend to do that!