improve stability
This commit is contained in:
parent
ed4d84590c
commit
18dd53ecf0
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user