You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a ScrollingObjectCollection name LeftScroll, it is a child of a gameobject name QSB which has SolverHandler to track the user's head.
LeftScroll has a GridObjectCollection inside the container, I scripted for the item to spawn inside the GridObjectCollection with the rotation of (0,0,0).
But in run time, whenever i turn around, the QSB's rotation changes so it can follow me, then the item spawned with the opposite rotation of the QSB ( for instance QSB (-5,30,0) -> item (5,-30,0)
##Steps to reproduce the behavior:
Create an object with solver handle to track the head
Create a child with scrollingobjectcollection -> gridobjectcollection inside container
Attached this script section inside the parent object and assign any object to be the item
"for (int i = 0; i < ItemsPerPage; i++)
{
ItemBox tmpBox = Instantiate(SpawnItemBox);
tmpBox.name = Manager.dataMachine[Manager.selectMachine].objectData[i].Name;
tmpBox.SetIconName(tmpBox.name);
tmpBox.transform.SetParent(ItemSlots);
tmpBox.SetQuadIcon(Manager.dataMachine[Manager.selectMachine].objectData[i].smallicon);
tmpBox.index = Manager.dataMachine[Manager.selectMachine].objectData[i].ID;
Debug.Log("item id:" + tmpBox.index);
tmpBox.transform.rotation = Quaternion.Euler(Vector3.zero);
tmpBox.transform.localScale = new Vector3(1, 1, 1);
ItemBoxes.Add(tmpBox);
}
StartCoroutine(InvokeUpdateCollection(griditem,scrollitem));
Debug.Log("Grid Updated");"}
private IEnumerator InvokeUpdateCollection(GridObjectCollection temp,ScrollingObjectCollection temp2)
{
yield return null;
temp.UpdateCollection();
yield return null;
temp2.UpdateContent();
}"
Run and see error
Expected behavior
Items spawned with rotation of (0,0,0) despite whatever direction the user's head.
Your setup (please complete the following information)
Unity Version [2021.3.16f1]
MRTK Version 2.8.3
Target platform (please complete the following information)
Meta Quest 2
The text was updated successfully, but these errors were encountered:
The solution is actually simple, instead of using the prop "rotation", just use the "localRotation"
Explaination
"rotation" is the absolute rotation of the object in the scene while the "localRotation" is relative to its parent, so set it to 0,0,0, the component should be aligned with its parent.
Describe the bug
I created a ScrollingObjectCollection name LeftScroll, it is a child of a gameobject name QSB which has SolverHandler to track the user's head.
LeftScroll has a GridObjectCollection inside the container, I scripted for the item to spawn inside the GridObjectCollection with the rotation of (0,0,0).
But in run time, whenever i turn around, the QSB's rotation changes so it can follow me, then the item spawned with the opposite rotation of the QSB ( for instance QSB (-5,30,0) -> item (5,-30,0)
##Steps to reproduce the behavior:
"for (int i = 0; i < ItemsPerPage; i++)
{
ItemBox tmpBox = Instantiate(SpawnItemBox);
tmpBox.name = Manager.dataMachine[Manager.selectMachine].objectData[i].Name;
tmpBox.SetIconName(tmpBox.name);
tmpBox.transform.SetParent(ItemSlots);
tmpBox.SetQuadIcon(Manager.dataMachine[Manager.selectMachine].objectData[i].smallicon);
tmpBox.index = Manager.dataMachine[Manager.selectMachine].objectData[i].ID;
Debug.Log("item id:" + tmpBox.index);
tmpBox.transform.rotation = Quaternion.Euler(Vector3.zero);
tmpBox.transform.localScale = new Vector3(1, 1, 1);
ItemBoxes.Add(tmpBox);
}
StartCoroutine(InvokeUpdateCollection(griditem,scrollitem));
Debug.Log("Grid Updated");"}
private IEnumerator InvokeUpdateCollection(GridObjectCollection temp,ScrollingObjectCollection temp2)
{
yield return null;
temp.UpdateCollection();
yield return null;
temp2.UpdateContent();
}"
Expected behavior
Items spawned with rotation of (0,0,0) despite whatever direction the user's head.
Your setup (please complete the following information)
Target platform (please complete the following information)
The text was updated successfully, but these errors were encountered: