Skip to content

Commit af45d44

Browse files
committed
fix(Interaction): parent of the outline highlighter cloned object
Change the parent of the OutlineObjectCopyHighlighter cloned object to the same parent as the original object. Change the parent setting to not re-compute world position. Change the transform assignments from world to local (faster), because now the parent is the same. The OutlineObjectCopyHighlighter cloned object needs to have the parent set to the same parent of the customOutlineModel to exactly match its shape. Even the PR #828 still causes problems with a hierarchy of game objects with different scaling (e.g customOutlineModel with its own scaling as child of the game object with its own scaling, holding the OutlineObjectCopyHighlighter component).
1 parent caf2f3c commit af45d44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Assets/VRTK/Scripts/Interactions/Highlighters/VRTK_OutlineObjectCopyHighlighter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ private void CreateHighlightModel()
145145
}
146146

147147
highlightModel = new GameObject(name + "_HighlightModel");
148-
highlightModel.transform.SetParent(transform);
149-
highlightModel.transform.position = copyModel.transform.position;
150-
highlightModel.transform.rotation = copyModel.transform.rotation;
151-
highlightModel.transform.localScale = Vector3.one;
148+
highlightModel.transform.SetParent(copyModel.transform.parent, false);
149+
highlightModel.transform.localPosition = copyModel.transform.localPosition;
150+
highlightModel.transform.localRotation = copyModel.transform.localRotation;
151+
highlightModel.transform.localScale = copyModel.transform.localScale;
152152

153153
foreach (var component in copyModel.GetComponents<Component>())
154154
{

0 commit comments

Comments
 (0)