Unity OVR Journey step by step tutorial + settings
position tracking with magnetometer
catching the falling cookie with a bowl logic
For this stage , I am using the headset’s position with a collider scripted to it, to check when the player is getting near to the cookie position. If he is then then the cookie drops .
Sharing some notes on my recent interaction with colliders .
The code that I am using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeMaterialColor : MonoBehaviour
{
[SerializeField] private Material myMaterial ;
private void OnTriggerEnter(Collider other)
{
Debug.Log("entered ");
if (other.CompareTag ("Player"))
{
myMaterial.color = Color.green;
//Debug.Log("entered color " + this.gameObject.name);
}
}
private void OnTriggerExit ( Collider other)
//Debug.Log("exited trigger " + this.gameObject.name);
{
Debug.Log("exitted ");
if ( other.CompareTag ("Player"))
{
myMaterial.color = Color.red;
//Debug.Log("exited color " + this.gameObject.name);
}
}
}
notes + settings ( It worked on a new project file)
red sphere: ( target object that changes state)
Collision zone :
player :