void KeepMoving() { rb.velocity = Vector3.zero; Vector3 FinalDirection = PlayerBalance.GetInitialPosition() - transform.position + CurrentDirection.normalized * 0.65f; if (RightFoot) { FinalDirection += PlayerBalance.GetHips().right * 0.2f; } else { FinalDirection -= PlayerBalance.GetHips().right * 0.2f; } FinalDirection.y = (FootHeight - transform.position.y) * 2f; rb.AddForce(FinalDirection * StepForce); /* * if (!MovingBack) * { * if (FootHeight - transform.position.y >= 0f) FinalDirection.y = FootHeight - transform.position.y; * else FinalDirection.y = transform.position.y - FootHeight; * } * else * { * if (FootHeight / 1f - transform.position.y >= 0f) FinalDirection.y = FootHeight / 1f - transform.position.y; * else FinalDirection.y = transform.position.y - FootHeight / 1f; * * } */ }
public void KeepMoving() { rb.velocity = Vector3.zero; Vector3 FinalDirection = PlayerBalance.GetInitialPosition() - transform.position + CurrentDirection.normalized * 0.9f; FinalDirection.y = PlayerBalance.transform.position.y - transform.position.y; rb.AddForce(FinalDirection * MoveForce); }