Hey, I’m really struggling with a good way to do this, mainly passing the variables through scripts. Ill start with the concept. In 3D (though it will be a 2d appearance to the user), I have 3 cubes and on each face an image. The cubes can be turned 90 degrees in place and I want to know which face and in which orientation each is facing the user. While i believe i can use the rotation values I have decided to do it by giving each cube corner a collider (8 total per cube) and since the cubes will be stationary and just rotating in place I have placed 4 trigger colliders so that 4 corners of each cube facing towards the user will trigger them. So that’s 3 cubes each with a collider on each corner and 4 stationary triggers per cube (Just trying to be as clear as possible not trying to talk down ). So what I want to do. I want to use the four stationary trigger colliders to get which corner collider is touching them and then using the name of that corner i will be able to pass the 4 names of the corners off the four trigger colliders and then using a game controller script compare them against a list of combinations to determine what side and in what orientation is facing the user. Should be 24 possible orientations. So say side 1 has a 1 facing up on it towards the user. The four corners in the switch colliders will be unique to that orientation. If you turn the cube 90 degrees a different side will face you and only two of the corners that were in triggers will still be in triggers but will be in different triggers and two corners previously not in triggers will be in triggers. I have the cubes and colliders built so i dont need to instantiate them in they will always be there. Each trigger should be able to return a public string with the collider name belonging to the cube’s corner.
This works to get which corner each trigger is in contact with:
public string trigger1;
public void OnTriggerStay(Collider other) {
string trigger1 = other.GetComponent<Collider>().name;
my problem comes in getting this string to another “game controller” script to compare with a short list. I can put a different variable in each script for each trigger (for simplicity but more time consuming) or use an array. As a user spins a cube i need it to update the corners and the game controller script. Any help is greatly appreciated. Post any questions for clarification below and i will follow up. thanks!