void onReleasedClimbable() { // Reset back to our original values if (smoothLocomotion) { smoothLocomotion.EnableMovement(); } // Gravity back to normal if (playerGravity) { playerGravity.ToggleGravity(true); } }
void checkClimbing() { GrippingClimbable = grippingAtLeastOneClimbable(); if (GrippingClimbable) { if (smoothLocomotion) { smoothLocomotion.DisableMovement(); } moveDirection = Vector3.zero; int count = 0; for (int i = 0; i < climbers.Count; i++) { Grabber climber = climbers[i]; if (climber != null && climber.HoldingItem) { Vector3 climberMoveAmount = climber.PreviousPosition - climber.transform.position; if (count == 0) { moveDirection += climberMoveAmount; } else { moveDirection += climberMoveAmount - moveDirection; } count++; } } characterController.Move(moveDirection); } else { if (smoothLocomotion) { smoothLocomotion.EnableMovement(); } } // Update any climber previous position for (int x = 0; x < climbers.Count; x++) { Grabber climber = climbers[x]; if (climber != null && climber.HoldingItem) { if (climber.DummyTransform != null) { // Use climber position if possible climber.PreviousPosition = climber.DummyTransform.position; } else { climber.PreviousPosition = climber.transform.position; } } } }