Search Unity

Parenting prop to bone causes bone origin the change

Discussion in 'Scripting' started by unitylepi, Apr 7, 2020.

  1. unitylepi

    unitylepi

    Joined:
    May 21, 2018
    Posts:
    34
    Hi, I have this very strange problem, whenever I parent a prop (simple mesh) to a bone in my model, many of the bones in the model suddenly start rotating around the prop, instead of at their own origins.

    example: I parent a ring object to a finger bone through code:

    ring.transform.parent = fingerbone.transform

    or :

    obj.transform.SetParent(fingerbone.transform);

    Now, instead of the arm bending at the elbow as usual, including this one c# statement causes the arm to rotate around the ring and the elbow to stretch out like a rubber band :(

    Same happens when I create a simple cube in the editor at runtime and parent it to the hand of my model in the scene hierarchy..
     
    Last edited: Apr 7, 2020
  2. unitylepi

    unitylepi

    Joined:
    May 21, 2018
    Posts:
    34
    Never mind, seems it only looked like the center was changing due to the pivot settings of the editor being set to Center :(
     
unityunity