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;
}
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;
}
Try this:
function Update() {
transform.position = Vector3(transform.position.x, transform.position.y, 0);
}
Thanks! It was so simple!
– smirlianos