Numerous improvments to the engine & physics system (thrust arrown, freezing, gimbal, etc...)
This commit is contained in:
@@ -6,12 +6,17 @@ public class InstrumentManager : MonoBehaviour
|
||||
{
|
||||
[Header("Input")]
|
||||
public InputActionReference throttleAction; // Your Input Action reference
|
||||
public InputActionReference attitudeAction; // Vector3 input for pitch/yaw/roll control
|
||||
|
||||
[Header("Throttle Settings")]
|
||||
public float rampSpeed = 1f; // Units per second
|
||||
|
||||
[Header("Attitude Control Settings")]
|
||||
public float attitudeResponseSpeed = 1f; // Multiplier for attitude input sensitivity
|
||||
|
||||
[Header("References")]
|
||||
public MainEngine mainEngine; // Reference to your engine script
|
||||
public GimbalSystem gimbalSystem; // Reference to gimbal control system
|
||||
// Referance to TextMeshPro Throttle slider
|
||||
public Slider throttleDisplay; // Reference to UI Slider component
|
||||
|
||||
@@ -26,16 +31,30 @@ public class InstrumentManager : MonoBehaviour
|
||||
{
|
||||
Debug.LogWarning("Throttle action reference is not set!");
|
||||
}
|
||||
|
||||
if (attitudeAction != null)
|
||||
{
|
||||
attitudeAction.action.Enable();
|
||||
Debug.Log("Attitude action enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("Attitude action reference is not set!");
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (throttleAction != null)
|
||||
throttleAction.action.Disable();
|
||||
|
||||
if (attitudeAction != null)
|
||||
attitudeAction.action.Disable();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// Handle throttle input
|
||||
if (throttleAction == null || mainEngine == null)
|
||||
return;
|
||||
|
||||
@@ -59,5 +78,23 @@ public class InstrumentManager : MonoBehaviour
|
||||
{
|
||||
throttleDisplay.value = mainEngine.throttleInput;
|
||||
}
|
||||
|
||||
// Handle attitude control input
|
||||
if (attitudeAction != null && gimbalSystem != null)
|
||||
{
|
||||
// Read Vector3 input
|
||||
Vector3 attitudeInput = attitudeAction.action.ReadValue<Vector3>();
|
||||
|
||||
// Apply attitude response speed multiplier
|
||||
attitudeInput *= attitudeResponseSpeed;
|
||||
|
||||
// Map inputs to gimbal system:
|
||||
// Y (up/down) → Pitch
|
||||
// X (left/right) → Yaw
|
||||
// Z (forward/backward) → Roll
|
||||
gimbalSystem.SetPitchInput(attitudeInput.y);
|
||||
gimbalSystem.SetYawInput(attitudeInput.x);
|
||||
gimbalSystem.SetRollInput(attitudeInput.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user