- Home /
Freezing Transforms
Hi everyone, is it possible to freeze a gameobject's transform axes? I have a standard first person controller and I would like to make it so it can't fall in the y axis.
If you are talking about the standard FPS Input Controller and a Character $$anonymous$$otor, can't you just set gravity to 0 in the Character$$anonymous$$otor script and turn off jumping?
Nope that still allows the Character Controller to fall. I don't want it to move in the y axis at all.
Answer by Fred_Vicentin · Apr 24, 2013 at 10:54 PM
If you are using de First Person Controller, go to the Character Motor Script (Inside your First Person Controller) open the Movement, clicking on the arrow, and set Gravity to 0.
But if you want to freeze another gameobject you can use transform.position.y = 0;
and change the y value, or using rigidbody, just freeze on the constrains options
Answer by Rydrako · Apr 24, 2013 at 10:52 PM
If you have a First Person from the Standard Assets then you should be able to disable jumping and set the gravity to 0 in the inspector variables.
If your making yourself a custom First Person Controller be sure to put this in your script:
function Update ()
{
transform.position.y = 0; //Or whatever height you want
}