Ok, so i made a 2d game and i want my charachter to crouch. I took the first person controller and moved the camera away so you saw the capsule (you charachter) And made some modifications and stuff. What i want is so when i press ctrl the capsules turns half its size like it was crouching. Don’t make the camera follow. Hope you know what i mean. Thx!
Also do anyone know how i make the camera smoothly follow at the x axis but not the y Axis? SO when you jump it doesen’t follow?
:-)!
Hello and welcome!
Could you please tell us what the “capsules” are?
Is that the collider of your 2d player character or is the capsule actually the model (mesh).
What you normally do is to change the animation of the character and then thrink the collider of the character (if you aren’t using colliders fixed to the body parts; think a ragdoll).
However, if you just want to change the scale of the gameObject you could use
transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y*0.5f,transform.localScale.z);
EDIT As for the camera - just remove the part where you translate in y-axis (please give us some examples of your code so we can give more precise answers).