how to crouch in unity
///requires character controller to be on player
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController rb;
void Start() {
rb = GetComponent<Rigidbody>();
}
void Update() {
if(Input.GetKey(KeyCode.C)) {
controller.height = 1f;
isCrouching = true;
speed = crouchWalk;
}
else
{
controller.height = 2f;
isCrouching = false;
speed = walkSpeed;
}
}
}
Also in C#:
- class selector to property in asp net core dropdown
- nullreferenceexception c#
- c# list to string
- c# retrieve files in folder
- c# make string null
- zoom gedit
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- .netstandard distinctby iqueryable
- convert string to boolean c#
- kotlin random number
- calculate impact damage + unity
- unity calculate path
- prefab gets character transform
- how to clear console in c#
- unity html get request
- c# list to string comma separated
- replace all ponctuation characters c#
- exception handling c#
- create asp.net which send email and sms using own api
- C# copy string except for last letter
- how to add movement in unity
- add spaces between words unity
- print line in python
- windows forms iterate through all controls