bool IsWithinPlayerHeadSlice(Bounds b) { float y = PlaneverbListener.GetInstance().GetPosition().y; float thisY = b.center.y; float halfHeight = b.extents.y; // extents are half sizes return((thisY - halfHeight) <= y && (thisY + halfHeight) >= y); }
void Start() { // enable singleton pattern Debug.AssertFormat(instance == null, "More than one instance of the PlaneverbListener created! Singleton violated."); instance = this; // init listener information in both contexts PlaneverbContext.SetListenerPosition(transform.position); PlaneverbDSPContext.SetListenerTransform(transform.position, transform.forward); }