- Home /
Question by
Thomvdm · Mar 29, 2016 at 03:14 PM ·
unity 5raycastraycastingoculus rift
Oculus Raycast different in Build (compared to Play Mode)
Hey,
When testing my application in Play Mode my raycast works fine, if I gaze at something through the Oculus the raycast hits it as well. However, when Building the application, the raycast is way off, hitting objects far to the left.
What causes this, and how could I fix this?
Editting in my code:
void Update()
{
drawRayCast();
if (Physics.Raycast(faceRay, out hit))//If something is hit
{
setObject(); //Select object that is looked at when none is selected yet
manipulateObject(); //Check if an object is selected, if so, allow manipulation
}
}
void setObject()
{
hitp = hit.point;
//If the raycast hits object with the right tag and nothing is selected yet
if (hit.collider.gameObject.HasTag("SelectableObject"))
{
if (objectToMove == null)
{
objectToMove = hit.collider.gameObject;
objectToMoveSelected = true;
}
}
}
void drawRayCast()
{
Debug.DrawRay(transform.position, transform.forward * 20, Color.green); //Draw line to debug
faceRay = new Ray(transform.position, transform.forward); //Create raycast
}
Thanks
Comment
Your answer