How to lerp child object rotation without effecting by parent object rotation

Hello everyone,
I am trying to lerp 4 tires rotation without effecting by parent car body rotation. How to achieve this?
This is how tires rotations should look like. I disabled car body rotation that’s why it’s working perfectly fine.

This is what happening when I am rotating car body also:

This is my script attached to each tire:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MenuTyreRotate : MonoBehaviour
{
    Quaternion tyreLand;
    Quaternion tyreAir;
 
    void OnEnable()
    {
        tyreLand = transform.GetChild(0).GetComponent<Transform>().rotation;
        tyreAir = Quaternion.identity;
        StartCoroutine(AirToLand());
    }

    IEnumerator AirToLand()
    {
        var t = 0f;

        while (t < 1f)
        {
            t += 1 * Time.deltaTime;
            transform.rotation =  Quaternion.Lerp (tyreAir, tyreLand, t);
            yield return null;
        }
        transform.rotation = tyreLand;
        StartCoroutine(LandToAir());

    }

    IEnumerator LandToAir()
    {
        var t = 0f;

        while (t < 1f)
        {
            t += 1 * Time.deltaTime;
            transform.rotation =  Quaternion.Lerp (tyreLand, tyreAir, t);
            yield return null;
        }
        transform.rotation = tyreAir;
        StartCoroutine(AirToLand());
    }
}

You should only be modifying transform.localRotation as that represents the rotation of the tyre relative to its parent.

If you modify transform.rotation you are setting its world space rotation, resulting in your wrong result.

Unrelated, but this is never necessary:
transform.GetChild(0).GetComponent<Transform>().rotation;It can simply be:transform.GetChild(0).rotation;

Th

Thank you so much. You solved my problem. :slight_smile: