mathf.Clamp limits on a 2.5d space shooter sidescroller game
Hello, I have an Issue with the comand Mathf.Clamp, I'm making a 2.5d Space Sidescroller Shooter, Im using a rail to move a Empty game object that contains the ship, and i want to create limits on that space also the empty object is the one that moves trough a rail on the level so the ship moves freely on the emty game object, I made the ship moves but when i use the mathf.Clamp like this:
spaceMove.transform.position = new Vector3(Mathf.Clamp(transform.position.x, -5f, 5f), Mathf.Clamp(transform.position.y, -5f, 5f), Mathf.Clamp(transform.position.z, -5f, 5f));
the ship don't follow the limits on the game also space move is a transform variable that is asigned to the emty game object,
i have readed various forums and unity answers so I can fix the problem but nothing had help me please someone may have the answer to mi issue, Thanks in advance, (sorry for my bad written english)
Your answer
Follow this Question
Related Questions
Isometric game : 2D or 3D project? 0 Answers
Animation and CharacterController in Unity3D 1 Answer
Why Does My Cube Player rotate 180 degrees when I start My game? 2 Answers
Space Shooter tutorial - Mathf.clamping boundaries 0 Answers
My script does not work each time i enter Unity unless i add it to the object again. any solutions? 0 Answers