GetListenerPosition() public static method

public static GetListenerPosition ( uint in_uIndex, AkTransform out_rPosition ) : AKRESULT
in_uIndex uint
out_rPosition AkTransform
return AKRESULT
Ejemplo n.º 1
0
    /// Returns whether the listener is currently inside the given |room| boundaries.
    public static bool IsListenerInsideRoom(WwiseGvrAudioRoom room)
    {
        // Compute the room position relative to the listener.
        AkSoundEngine.GetListenerPosition(0, listenerTransform);
        Vector3 listenerPosition = new Vector3(listenerTransform.Position().X,
                                               listenerTransform.Position().Y,
                                               listenerTransform.Position().Z);
        Vector3    relativePosition = listenerPosition - room.transform.position;
        Quaternion rotationInverse  = Quaternion.Inverse(room.transform.rotation);

        // Set the size of the room as the boundary and return whether the listener is inside.
        bounds.size = Vector3.Scale(room.transform.lossyScale, room.size);
        return(bounds.Contains(rotationInverse * relativePosition));
    }