- Home /
Question by
smirlianos · Mar 02, 2013 at 05:14 PM ·
transformpositionaxisplatformerz
Prevent changing position
I'm making a platformer game, so I want the player to has the Z axis always to zero. I made this part of script, but it doesn't work. How should I fix it?
if(transform.position.z > 0)
{
transform.position.z = 0;
}
Comment
Best Answer
Answer by pazzesco · Mar 02, 2013 at 05:19 PM
Try this:
function Update() {
transform.position = Vector3(transform.position.x, transform.position.y, 0);
}
Your answer
Follow this Question
Related Questions
How far do the axis go? 1 Answer
transform.position.x ? 1 Answer
transform.position.y and x or z + 1? 0 Answers