float ComputeIndividualMoveSize(Hand hand) { float distance = Vector3.Distance(this.transform.position, hand.transform.position); if (distance < influenceZone) return Mathf.Abs(hand.GetMove().x) + Mathf.Abs(hand.GetMove().y) + Mathf.Abs(hand.GetMove().z); return 0.0f; }
private Vector3 ComputeMoves(Hand hand) { float distance = Vector3.Distance(this.transform.position, hand.transform.position); Vector3 movement = Vector3.zero; if (distance < influenceZone) { Vector3 handMovement = hand.GetMove(); if (disturbance < 10 - (Mathf.Abs(handMovement.x + handMovement.y + handMovement.z))) disturbance += Mathf.Abs(handMovement.x + handMovement.y + handMovement.z); movement.x = handMovement.y * Mathf.Pow((influenceZone - distance), 2) * (Mathf.Exp(-Mathf.Pow((disturbance - 4) / 3, 2))) * Random.Range(0.2f, 8.0f); movement.z = handMovement.z * Mathf.Pow((influenceZone - distance), 2) * (Mathf.Exp(-Mathf.Pow((disturbance - 4) / 3, 2))) * Random.Range(0.2f, 8.0f); } return movement; }