- Home /
Ignore parent Rotation
Hi,
I want to attach a separate hitbox to an rotating object. However, I don't want it to rotate with the parent.
I tried:
function Update() {
transform.rotation = Quaternion.identity;
}
However when the parent rotates, the child still changes position slightly. So I tried setting the hitbox object manually with transform.position = position;.
However this seems to negate the collision ability of the hitbox. When the parent moves the hitbox ignores all collision.
Any ideas about how I could go about this?
Comment
Answer by patrik-org · Apr 03, 2014 at 02:03 PM
Perhaps change the object hierarchy from:
rotatingObject
|- HitBoxObject
To:
parentObject
|- rotatingObject
|- hitBoxObject
That way the rotatingObject's transform doesn't change the transform of the hitBoxObject but you can still perform translations on both by changing the transform on parentObject.
Your answer
![](https://koobas.hobune.stream/wayback/20220613141843im_/https://answers.unity.com/themes/thub/images/avi.jpg)