UNITY • ANIMATION & C#
HOW TO MAKE A HELICOPTER ROTOR ROTATE IN UNITY
Animate main and tail rotor blades smoothly with dynamic engine startup, continuous high-speed RPM blur, and realistic shutdown coasting.
Quick Answer
In Update(), rotate the rotor transform around its local Y-axis (or X-axis for tail rotors) using transform.Rotate(Vector3.up * currentRpm * Time.deltaTime, Space.Self), smoothly interpolating currentRpm using Mathf.MoveTowards() for realistic engine ignition.
1
The Dual Rotor Controller C# Script
Create a C# script named HelicopterRotor.cs:
HelicopterRotor.cs (C#)
using UnityEngine;
public class HelicopterRotor : MonoBehaviour
{
[Header("Rotor Transforms")]
[SerializeField] private Transform mainRotor;
[SerializeField] private Transform tailRotor;
[Header("Rotation Axes")]
[SerializeField] private Vector3 mainRotorAxis = Vector3.up;
[SerializeField] private Vector3 tailRotorAxis = Vector3.right;
[Header("Speed & Acceleration")]
[SerializeField] private float maxMainRpm = 1800f; // degrees per second
[SerializeField] private float maxTailRpm = 3600f;
[SerializeField] private float spinUpRate = 450f;
[SerializeField] private float spinDownRate = 250f;
[Header("Engine State")]
[SerializeField] private bool engineActive = true;
private float currentRpmNormalized = 0f;
public float CurrentRpmRatio => currentRpmNormalized;
private void Update()
{
// Smoothly ramp RPM up or down
float targetRatio = engineActive ? 1f : 0f;
float rate = engineActive ? spinUpRate : spinDownRate;
currentRpmNormalized = Mathf.MoveTowards(currentRpmNormalized, targetRatio, (rate / maxMainRpm) * Time.deltaTime);
// Spin Main Rotor
if (mainRotor != null)
{
float mainSpeed = maxMainRpm * currentRpmNormalized * Time.deltaTime;
mainRotor.Rotate(mainRotorAxis * mainSpeed, Space.Self);
}
// Spin Tail Rotor
if (tailRotor != null)
{
float tailSpeed = maxTailRpm * currentRpmNormalized * Time.deltaTime;
tailRotor.Rotate(tailRotorAxis * tailSpeed, Space.Self);
}
}
public void SetEngineState(bool isActive)
{
engineActive = isActive;
}
}
2
Hierarchy & Pivot Point Setup
- Pivot Point: Ensure your 3D modeler (Blender/Maya) positioned the pivot point of both rotors directly at the center of the shaft.
- Space.Self: Always pass
Space.SelftoRotate()so that when the helicopter banks and rolls during flight, the blades continue spinning perpendicular to the rotor hub.