Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
Restoring stable hover rotation
UnityEngine.Debug:Log (object)
GrindDetection:RestoreStableHoverRotation () (at Assets/GrindDetection.cs:289)
GrindDetection:RampDetection () (at Assets/GrindDetection.cs:261)
GrindDetection:FixedUpdate () (at Assets/GrindDetection.cs:58)
using UnityEngine;
public class GrindDetection : MonoBehaviour
{
[Header("Rail Settings")]
[SerializeField] private float railDetectionRadius = 2f;
private Rail rail;
private HoverBoardControl hoverBoardControl;
[Header("Trick Colliders")]
[SerializeField] private Transform frontTruckTransform;
[SerializeField] private Transform backTruckTransform;
[SerializeField] private Transform boardMiddleTransform;
[SerializeField] private Transform noseTransform;
[SerializeField] private Transform tailTransform;
private GrindTrigger frontTruck => frontTruckTransform.GetComponent<GrindTrigger>();
private GrindTrigger backTruck => backTruckTransform.GetComponent<GrindTrigger>();
private GrindTrigger boardMiddle => boardMiddleTransform.GetComponent<GrindTrigger>();
private GrindTrigger nose => noseTransform.GetComponent<GrindTrigger>();
private GrindTrigger tail => tailTransform.GetComponent<GrindTrigger>();
[Header("Settings")]
[SerializeField] private float grindControlSensitivity = 1f;
[SerializeField] private float grindSpeed = 50f;
[Header("Input Settings")]
[SerializeField] private KeyCode grindKey = KeyCode.G;
[Header("Ramp Detection Settings")]
[SerializeField] private float minRampAngle = 80f;
[SerializeField] private float maxRampAngle = 100f;
private Collider[] railColliders;
private Collider railCollider;
private Rigidbody rb;
private float sidewaysAngle;
private float frontsideBacksideAngle;
private bool railTravelBackwards;
private bool isGrindingOrSliding;
private bool previouslyDetectedRamp;
private void Awake()
{
hoverBoardControl = GetComponentInParent<HoverBoardControl>();
rb = GetComponentInParent<Rigidbody>();
}
private void FixedUpdate()
{
GetRail();
GrindSlideCheck();
GetRotationRelativeToCamera();
RampDetection();
}
private void GetRail()
{
railColliders = Physics.OverlapSphere(rb.position, railDetectionRadius, LayerMask.GetMask("Rail"));
if (railColliders.Length != 0)
{
railCollider = railColliders[0];
rail = railCollider.GetComponent<Rail>();
}
if (!isGrindingOrSliding && hoverBoardControl.IsGrounded)
{
railColliders = null;
}
}
private void GetRotationRelativeToCamera()
{
Vector3 forward = hoverBoardControl.transform.forward;
Vector3 forward2 = rb.transform.forward;
sidewaysAngle = Vector3.Dot(forward, forward2);
frontsideBacksideAngle = Vector3.Dot(forward, rb.transform.right);
}
private void GrindSlideCheck()
{
if (railCollider == null)
{
return;
}
float num = Vector3.Dot(hoverBoardControl.transform.forward, rail.transform.forward);
if (num > 0f)
{
railTravelBackwards = false;
}
else if (num < 0f)
{
railTravelBackwards = true;
}
bool boardSlideCheck = boardMiddle.Trigger;
bool frontTruckGrindCheck = frontTruck.Trigger;
bool backTruckGrindCheck = backTruck.Trigger;
bool noseSlideCheck = nose.Trigger;
bool tailSlideCheck = tail.Trigger;
if (frontTruckGrindCheck || backTruckGrindCheck)
{
if (sidewaysAngle > 0.3f || sidewaysAngle < -0.3f)
{
rb.isKinematic = true;
hoverBoardControl.IsGrounded = false;
hoverBoardControl.GrindAudioVolumeLerp(1f, 20f);
float num2 = hoverBoardControl.BoardTilt.x * grindControlSensitivity;
float num3 = hoverBoardControl.BoardTilt.y * grindControlSensitivity;
float num4 = 50f;
if (railTravelBackwards)
{
num3 = -num3;
}
if (backTruckGrindCheck && frontTruckGrindCheck)
{
rb.transform.RotateAround(backTruckTransform.position, new Vector3(0f, 1f, 0f), num2 * Time.deltaTime);
rb.transform.RotateAround(backTruckTransform.position, rail.transform.right, num3 * Time.deltaTime);
}
if (backTruckGrindCheck)
{
RotateWithSteering(backTruckTransform, num2, num3, num4);
}
else if (frontTruckGrindCheck)
{
RotateWithSteering(frontTruckTransform, num2, num3, num4);
}
}
}
else if (tailSlideCheck || noseSlideCheck)
{
rb.isKinematic = true;
hoverBoardControl.IsGrounded = false;
hoverBoardControl.GrindAudioVolumeLerp(0f, 20f);
float num5 = 50f;
float num6 = 5f;
rb.transform.localRotation = Quaternion.Lerp(rb.transform.localRotation, Quaternion.Euler(new Vector3(rb.transform.localEulerAngles.x, rb.transform.localEulerAngles.y, 0f)), num6 * Time.deltaTime);
float num7 = hoverBoardControl.BoardTilt.y * grindControlSensitivity;
if (railTravelBackwards)
{
num7 = -num7;
}
if (noseSlideCheck)
{
RotateWithSteering(noseTransform, 0f, num7, num5);
}
else if (tailSlideCheck)
{
RotateWithSteering(tailTransform, 0f, num7, num5);
}
}
else if (boardSlideCheck)
{
rb.isKinematic = true;
hoverBoardControl.IsGrounded = false;
hoverBoardControl.GrindAudioVolumeLerp(1f, 20f);
float num8 = -rail.transform.localEulerAngles.x;
if (frontsideBacksideAngle < -0.3)
{
num8 = -num8;
}
if (railTravelBackwards)
{
num8 = -num8;
}
rb.transform.localRotation = Quaternion.Lerp(rb.transform.localRotation, Quaternion.Euler(new Vector3(num8, rb.transform.localEulerAngles.y, 0f)), 5f * Time.deltaTime);
float num9 = 50f;
if (railTravelBackwards)
{
num9 = -num9;
}
rb.transform.Rotate(Vector3.up * grindSpeed * Time.deltaTime, Space.World);
Vector3 position = rb.position;
float num10 = 0.1f;
position = Vector3.Lerp(position, railCollider.ClosestPoint(position), num10);
rb.position = position;
hoverBoardControl.transform.localRotation = rb.transform.localRotation;
hoverBoardControl.transform.rotation = rb.transform.rotation;
if (boardMiddle.Trigger)
{
StartGrind(); // Add this line to start the grind
}
}
else
{
rb.isKinematic = true;
hoverBoardControl.IsGrounded = false;
hoverBoardControl.GrindAudioVolumeLerp(0f, 20f);
Vector3 position2 = rb.position;
position2 = Vector3.Lerp(position2, railCollider.ClosestPoint(position2), 0.1f * Time.deltaTime);
rb.position = position2;
rb.transform.rotation = Quaternion.Lerp(rb.transform.rotation, Quaternion.Euler(0f, rb.transform.eulerAngles.y, 0f), 20f * Time.deltaTime);
hoverBoardControl.transform.localRotation = rb.transform.localRotation;
hoverBoardControl.transform.rotation = rb.transform.rotation;
if (tail.Trigger || nose.Trigger)
{
// Adjust rotations and movements as needed
}
}
}
private void RotateWithSteering(Transform truckTransform, float num2, float num3, float num4)
{
rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), num2 * Time.deltaTime);
rb.transform.RotateAround(truckTransform.position, rail.transform.right, num3 * Time.deltaTime);
if (hoverBoardControl.IsSteeringLeft)
{
rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), (0f - num4) * Time.deltaTime);
}
else if (hoverBoardControl.IsSteeringRight)
{
rb.transform.RotateAround(truckTransform.position, new Vector3(0f, 1f, 0f), num4 * Time.deltaTime);
}
}
private void RampDetection()
{
RaycastHit hit;
bool rampDetected = false;
// Check the colliders at the nose and tail to see if they’re detecting a ramp.
Collider[] hoverPointColliders = new Collider[] { nose.GetComponent<Collider>(), tail.GetComponent<Collider>() };
foreach (Collider hoverPointCollider in hoverPointColliders)
{
if (Physics.Raycast(hoverPointCollider.transform.position, Vector3.down, out hit, hoverBoardControl.hoverHeight, LayerMask.GetMask("Ramp")))
{
// Debug log when a ramp is detected
Debug.Log(hoverPointCollider.name + " detected a ramp collision");
rampDetected = true;
AdjustRotationBasedOnRamp(hit, hoverPointCollider.name);
break; // Break after the ramp has been detected and handled
}
}
// If no ramp detected, ensure the board maintains a stable hover rotation
if (!rampDetected)
{
hoverBoardControl.IsGrounded = false; // The board should not be considered grounded
// Debug log when no ramp is detected, and we previously detected one
if (previouslyDetectedRamp)
{
Debug.Log("No ramp currently detected");
}
RestoreStableHoverRotation();
}
previouslyDetectedRamp = rampDetected;
}
private void AdjustRotationBasedOnRamp(RaycastHit hit, string hitPart)
{
// Debug log when adjusting rotation based on ramp
Debug.Log("Adjusting rotation based on ramp. Part: " + hitPart);
Vector3 rampNormal = hit.normal; // The normal of the ramp surface
Vector3 projectedForward = Vector3.ProjectOnPlane(hoverBoardControl.transform.forward, Vector3.up);
float rampAngle = Vector3.Angle(rampNormal, Vector3.up) - 90.0f; // Calculate the angle of the ramp
// Calculate the needed rotation to align with the ramp angle
float targetXRotation = rampAngle;
// Smoothly interpolate towards the ramp angle
Quaternion targetRotation = Quaternion.Euler(targetXRotation, hoverBoardControl.transform.rotation.eulerAngles.y, hoverBoardControl.transform.rotation.eulerAngles.z);
hoverBoardControl.TransformRotationLerp(targetRotation, 5f);
// ... (unchanged code)
}
private void RestoreStableHoverRotation()
{
// Debug log when restoring stable hover rotation
Debug.Log("Restoring stable hover rotation");
// ... (unchanged code)
}
public bool IsGrinding()
{
return isGrindingOrSliding;
}
public KeyCode GrindKey
{
get { return grindKey; }
}
// Add the StartGrind method
public void StartGrind()
{
isGrindingOrSliding = true;
}
}