- Home /
This question was
closed Sep 19, 2017 at 07:31 AM by
hexagonius for the following reason:
Besides help no problem stated
Question by
nzmichael118 · Sep 19, 2017 at 05:20 AM ·
fpscontroller
Making slide script need help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Crouch : MonoBehaviour {
CharacterController characterCollider;
void Start () {
characterCollider = gameObject.GetComponent<CharacterController> () ;
}
void Update ()
{
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.C)) // does not work
{
characterCollider.height = 0.5f;
}
else
{
if (Input.GetKey(KeyCode.C)) // works fine
{
characterCollider.height = 1.0f;
}
else
{
characterCollider.height = 1.8f;
}
}
}
}
Help?
Comment