I'm making a 2d platformer in 3D mode, it's part of the work requirements so i don't have much choice, but the problem i currently have is that my script has the player liable to get knocked off when jumping from platform to platform and then plummeting but if it does manage to stay on the platform it will move on the local axis rather than the global. My movement code is currently this Code (CSharp): private float horizontInput; void Update() { horizontInput= Input.GetAxis("Horizontal"); transform.Translate(Vector3.forward *Time.deltaTime * playerSpeed * horizontInput); }
https://docs.unity3d.com/ScriptReference/Transform.Translate.html Code (CSharp): public void Translate(Vector3 translation, Space relativeTo = Space.Self); https://docs.unity3d.com/ScriptReference/Transform-localPosition.html <- not mine
Transform.Translate moves the object on its local axis by default. You can pass in the optional second parameter and specify it as Space.World to move the object along the world axis. I'm not sure what you mean by this. Can you elaborate?
It's that if the player hits a higher platform than its current position it can get knocked out of the game and i'd have to reset the test.