private void FixedUpdate() { if (!paused) { if (!swimming) { if (!sensor.info.down) { targetSpeed -= gravity * Time.fixedDeltaTime * Vector2.up; } ClampSpeed(maxSpeedX, maxSpeedY); } else { if (Mathf.Abs(Input.GetAxis("Vertical")) < 10E-2 && Mathf.Abs(Input.GetAxis("Horizontal")) < 10E-2) { targetSpeed -= dampeningFactor * targetSpeed; targetSpeed -= Time.deltaTime * gravity_swimming * Vector2.up; } ClampSpeed(maxSpeedSwimmingX, maxSpeedSwimmingY); } MovementModifier.SetSpeed(targetSpeed); deltaPosition = targetSpeed * Time.fixedDeltaTime; ClipManager.SetDeltaPosition(deltaPosition); } }
private void FixedUpdate() { if (!paused) { if (!sensor.info.down) { targetSpeed -= gravity * Time.fixedDeltaTime * Vector2.up; } ClampSpeed(maxSpeedX, maxSpeedY); // movementModifier.SetSpeed(targetSpeed); deltaPosition = targetSpeed * Time.fixedDeltaTime; clipManager.SetDeltaPosition(deltaPosition); if (deltaPosition.magnitude >= .5f) { movementModifier.moving = true; } else { movementModifier.moving = false; } } }