Avoid the rotation of child objects
Goodmorning,
In my project the camera is orthogonal and starting from the far side I've got: - A light; - A sphere that rotate; - A light;
These objects have got a parent-child structure: - Sphere ->Light1 ->Light2
The sphere spins on his x axys and cause the lights are child of the sphere they rotate around the sphere too.
I tried to avoid this using some code found in Unity Answer: Quaternion rotation; void Awake() { rotation = transform.rotation; } void LateUpdate() { transform.rotation = rotation; }
but it doesnt work: I've to lock either the position?
This might not be the answer you want, but how about
voic LateUpdate() {
transform.EulerAngles = new Vector3(0,0,0);
}
with Vector3's x y z being the actual rotation of the child objects you have currently.
Your answer
![](https://koobas.hobune.stream/wayback/20220612075353im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiated Object Has Wrong Rotation 0 Answers
Rotation and Gravity Relative to the Center of an Object 0 Answers
With VR character's rotation is applied twice or double 1 Answer
Using LookAT causes no rotation at all? 1 Answer
rotation problems 0 Answers