When rotating child objects, they deform when rotating

Hello!

So I’m trying to do the easiest of things, rotate an object. Here’s the code:

using UnityEngine;
using System.Collections;

public class WheelRotator : MonoBehaviour {

    public int speed;
    // Use this for initialization
    void Start ()
    {
      
    }
  
    // Update is called once per frame
    void Update ()
    {
        transform.Rotate(Vector3.forward, speed * Time.deltaTime, Space.World);
    }
}

Seems easy. Problem is, I absolutely need the object to be a child of another object (due to how I’m generating the game’s world). However, when rotating a child object, it gets stretched and distorted awfully:


It’s incredible that I’ve been in Unity for about a year and only now got stumped by this. It gets stretched even when changing the Z component in the editor manually. Is there any way at all to rotate a child gameObject without messing up its shape?

Thank you!

Check the parent scale, if its not uniform (like 1,1,1) i think that happens…

3 Likes

Parent scale is 15, 1, 1. Do I need to make another parent that is 1, 1, 1? I’m very surprised by this lol

the scale can also be (0.6, 0.6, 0.6) or (500, 500, 500), or anything as long as the x, y, and z values are the same!

if thats what “uniform” means, then sorry for taking some of your credit, mgear.

1 Like

Interesting i did this, created a new transform then child ed my collection of objects and nested objects and still distorted the children. 2019.3. not behaving very nicely :slight_smile:

1 Like