Quantcast
Channel: Answers for "Keeping speed while crouching in midair and remove clipping while returning to standing"
Viewing all articles
Browse latest Browse all 4

Answer by Hordaland

$
0
0

Thanks alot! The speed is now the same even while I crouch midair. I also disabled the ability to jump while crouched since it's not appropriate behaviour to do so in the kind of slowpaced game I'm making.

The raycast worked after a light tweak I had to make since Unity gave me an error. Now it looks like this:

function Update(){

var hit : RaycastHit; ...

// if crouch button has been pressed, put FPS into crouch
if (Input.GetButtonDown ("Crouch")){
    if(crouching && !Physics.Raycast(transform.position, Vector3.up, hit, distUp)){
        stopCrouching();
        return;
    }
    if(!crouching)
         crouch();
}

The only issue I have is that if I don't stand directly below the object the rays won't hit. Is there any possibility to shoot out more rays and in different directions so that my whole character can enjoy this feeling of not being able to stand straight?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images