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?

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.