private void UpdatePath() { Vector3 startPosition = new Vector3(Position.x, 0, Position.z); Vector3 targetPosition = touchInput.lastTapStartPosition.groundPosition; Vector3 startMovement; if (transform.parent != null && transform.parent.GetComponent <Rigidbody>().velocity.sqrMagnitude > 0F) { startMovement = transform.parent.GetComponent <Rigidbody>().velocity; } else { startMovement = (targetPosition - startPosition).normalized; } if (startMovement.magnitude < MIN_START_SPEED) { startMovement.Normalize(); startMovement *= MIN_START_SPEED; if (transform.parent != null) { transform.parent.GetComponent <Rigidbody>().velocity = startMovement; } } Vector3 targetMovement = touchInput.lastTapReleasePosition.groundPosition - touchInput.lastTapStartPosition.groundPosition; if (touchInput.lastTapReleaseTime - touchInput.lastTapStartTime > Player.JUMP_TAP_DURATION) { path = new Helpers.HermiteSpline(startPosition, startMovement, targetPosition, targetMovement); } }
private void ResetPath(Collision col) { Debug.Log("reset Path"); path = null; }