improve stability

This commit is contained in:
John Wigner 2025-02-01 12:18:53 -05:00
parent ed4d84590c
commit 18dd53ecf0
2 changed files with 131 additions and 155 deletions

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,7 @@ public class StableHovercarController : BaseHovercarController
// Compute the target hover position. // Compute the target hover position.
Vector3 targetPosition = interpolatedPoint + interpolatedNormal * hoverHeight; Vector3 targetPosition = interpolatedPoint + interpolatedNormal * hoverHeight;
transform.position = Vector3.Lerp(transform.position, targetPosition, Time.fixedDeltaTime * positionAdjustmentSpeed); rb.MovePosition(Vector3.Lerp(transform.position, targetPosition, Time.fixedDeltaTime * positionAdjustmentSpeed));
// Smoothly rotate the vehicle to align with the terrain. // Smoothly rotate the vehicle to align with the terrain.
Quaternion targetRotation = Quaternion.FromToRotation(transform.up, interpolatedNormal) * transform.rotation; Quaternion targetRotation = Quaternion.FromToRotation(transform.up, interpolatedNormal) * transform.rotation;