# How can I calculate a local rotation angle of subobjects along with the local y-axis with respect to the parent's object?

I want to calculate the local rotation angle along with the local y-axis.
How can I calculate a local rotation angle of subobjects along with the local y-axis with respect to the parent’s object?
Thank you.,How can I calculate a local rotation angle of subobjects along with the local y-axis with respect to the parent’s object?

Not sure if I completly understand what you mean but to put it in my words:

You want to calculate the angle between the y-axis of transform A and the y-Axis of transform B, where B is the child of A?

If that is the case try this:

``````  float angle = Vector3.Angle(transform.up, transform.parent.up);
``````

(This assumes that we calculate this on the child transform)
To put it more generalized:

``````  Transform childTrans = transform.Find("someChild");
float angle = Vector3.Angle(transform.up, childTrans.up);
``````

Let me know if that helped…