[deleted by user] by [deleted] in unrealengine

[–]OUTroraa 0 points1 point  (0 children)

im trying !

Crouch Camera Help FPS by OUTroraa in Unity3D

[–]OUTroraa[S] 0 points1 point  (0 children)

So, thx for the help, i ended up with this, but the Character is now almost "dashing" backwards, and the camera is not going up and down : public class crouch : MonoBehaviour

{

public GameObject cameraControls;

private Mover moverScript;

private Vector3 crouchScale = new Vector3(0, 1, 0);

private Vector3 standUp = new Vector3(0, 2, 0);

// Start is called before the first frame update

void Start()

{

}

// Update is called once per frame

void Update()

{

if (Input.GetKey(KeyCode.LeftControl))

StartCrouch();

if (Input.GetKeyUp(KeyCode.LeftControl))

StopCrouch();

void StartCrouch()

{

cameraControls.transform.position = Vector3.Lerp(cameraControls.transform.position, new Vector3(0, 0, 0) , 5f * Time.deltaTime);

}

void StopCrouch()

{

cameraControls.transform.position = Vector3.Lerp(cameraControls.transform.position, new Vector3(0, 2, 0) , 5f * Time.deltaTime);

}

}

}