Quantcast
Channel: Questions in topic: "independent"
Viewing all articles
Browse latest Browse all 102

Jump not affected by changing velosity.y

$
0
0
Hello :) I've just done double jump in my game and in a some way it's affected by changing velosity.y by game object. It means the power of second jump depends on a time(?) and changing velosity.y(?) between double clicking "Space". I want to make it independent and the jump's power is need to be the same all the time. Where am I wrong? Thanks in advance! Tomas void Update () { if(Input.GetKeyDown(KeyCode.Space)) { if(grounded) { rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving)); grounded = false; jumpCounter = 1; } else if(!grounded && jumpCounter == 1) { jumpCounter++; rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving)); //Debug.LogError("And second jump"); } } }

Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>