Summary of whats already working and what is going on:
(IMAGE ONE) 1. A hider first selects a piece of furniture to hide their object in. When they submit, the object translates to the position of the furniture. When the object collides with the chosen furniture, the object gets hidden (disabled) inside the chosen furniture.
(IMAGE TWO) 2. The detectives (3 of them) take turns tapping (highlighting) furniture they think it is under. At the end of the turn, if the object is hidden under any of the highlighted furniture, the object is found (enabled).
if (Input.GetMouseButtonDown(0))
{
//Send raycast to hit a game object
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
text.text = question;
// Casts the ray and get the first game object hit
if (Physics.Raycast (ray, out hit, Mathf.Infinity, layerToHit)) {
lastClicked = hit.collider.gameObject.transform;
clickedGameObject = hit.collider.gameObject;
tapLastClicked = hit.collider.gameObject.transform;
//THIS IS FOR THE HIDER SELECTING AND SENDING OBJECT TO DESIRED FURNITURE
if (hit.collider.tag == "Object" && lastClicked != null && spawned == false && sessionCounter == 0 && taptaptapSelect.enabled == false) {
//Debug.Log ("This hit at " + hit.transform.name);
print (lastClicked.name);
objectSelect.enabled = true;
objectIsHere = lastClicked;
moveOn = false;
//THIS IS FOR THE FIRST DETECTIVE HIIGHLIGHTING A SPECIFIC FURNITURE
} else if (hit.collider.tag == "Object" && lastClicked != null && taptaptapSelect.enabled == true ) {
//Debug.Log ("This hit at " + hit.transform.name);
rend = clickedGameObject.GetComponent<Renderer> ();
tapOneOriginalMaterial = rend.material;
//tapOne = lastClicked.gameObject;
print (clickedGameObject.gameObject.name );
print ("Tap One");
//tapCounter += 1;
tapOneBool = true;
rend.material = diffuseShaderPlayerOne;
//What is the best method to detect when the object is under one of the highlighted furniture? I’ve tried many different methods and no luck so far. All my code is working, other than this system I’m trying to get going. I’d appreciate all the help