public void SlidingDetection() { float skidValue; // absolutna hodnota smyku // pomer rychlosti otacania kolesa a rychlosti kolesa (t.j. aku vzdialenost preslo) skidValue = Mathf.Abs(joint.jointSpeed / joint.GetComponent <Rigidbody2D>().velocity.magnitude); if ((skidValue / skidConstant > 1.03 || skidValue / skidConstant < 0.95) && this.groundContact && joint.GetComponent <Rigidbody2D>().velocity.x > 0.1f) { this.sliding = true; } else { this.sliding = false; } }
private void Start() { rb_left = left.GetComponent <Rigidbody2D>(); rb_right = right.GetComponent <Rigidbody2D>(); }