вот написал скрипт по примеру но нечего не работает помогите пожалуйста.
Code
using UnityEngine;
using System.Collections;
public class Duck : MonoBehaviour {
public CharacterController controller;
public BoxCollider cillider;
private Vector3 nScale, nBoxSize;
private Vector3 cScale, cBoxSize;
void Start () {
controller = GetComponen<CharacterController>();
collider = GetComponent<BoxCollider>();
nScale = transform.localScale;
nBoxSize = collider.size;
cSxale = transform.localScale - new Vector3 (0.5f, 0.5f, 0.5f);
cBoxSize = new Vector3(collider.size.x * 2, collider.size.y, collider.size.z * 2);
}
void Update () {
Vector3 nPos = new Vector3(transform.position.x, transform.position.y + controller.height / 4, transform.position.z);
if (Input.GetKey(KeyCode.LeftControl)){
transform.localScale = nScale;
collider.size = nBoxSize;
}else if(Input.GetKeyUp(KeyCode.LeftControl)){
transform.localScale = nScale;
collider.size = nBoxSize;
transform.position = nPos;
}
}
}