Quantcast
Channel: Questions in topic: "pipe"
Viewing all articles
Browse latest Browse all 89

Aqueducts connecting.

$
0
0
Hello, we are trying to make a mechanic in our game which acts almost like a 3D water pipe game, the code below that we used did work and then just stopped. Does anyone have any ideas why or how to get it working or any ideas to approach it. using UnityEngine; using System.Collections; public class PM_WoodAqueductTrigger : MonoBehaviour { public bool horizontal; public bool cornerPiece; public GameObject aqueduct; void OnTriggerEnter (Collider other) { if(cornerPiece == false) { if (other.gameObject.tag == "Aqueduct") { if (horizontal == true && (Vector3.Dot(other.gameObject.transform.forward, Vector3.forward) == 1 || Vector3.Dot(other.gameObject.transform.forward, Vector3.forward) == -1)) { aqueduct = other.gameObject; } else if (horizontal == false&& (Vector3.Dot(other.gameObject.transform.right, Vector3.forward) == 1 || Vector3.Dot(other.gameObject.transform.right, Vector3.forward) == -1)) { aqueduct = other.gameObject; } } } else { if (other.gameObject.tag == "Aqueduct2"&& (Vector3.Dot(other.gameObject.transform.right, Vector3.right) == 1 && Vector3.Dot(other.gameObject.transform.forward, Vector3.forward) == 1)) { aqueduct = other.gameObject; } } } void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Aqueduct" || other.gameObject.tag == "Aqueduct2") { aqueduct = null; } } }

Viewing all articles
Browse latest Browse all 89

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>