My game is first person. I am trying to make it so when somthing in is your field of view and you look away and then look back again it has changed to somthing else. And it won’t change unless you actaully look away…not sure if i’m explaing this well. and I’m not sure how to go about doing this. A good example of what i’m trying to do is somthing like in the Oculus Rift game called “Line of sight: the chair” if you haven’t tried it i think there is a PC version to.
One option would be to create a Collider, deform it such that it mimics somewhat your camera view angles, then use OnTriggerEnter and OnTriggerExit to add/remove “changing items” to some sort of internal list. You would then, at some regular interval, loop through the list and raycast from the camera to the object to see if it is visible (You probably wouldn’t want to do this on Update).
I haven’t tested this approach at all, so I can’t speak to its efficiency.
//Put this script on the camera or whatever is running the game.
public GameObject scaryObject; //Set this in the editor
if(!scaryObject.renderer.isVisible) {
scaryObject.transform.position = new Vector3(1f, 1f, 1f);
}