private void DebugDrawDiffraction()
    {
        if (AkSoundEngine.QueryDiffractionPaths(gameObject, pathsParams, diffractionPathInfoArray,
                                                (uint)diffractionPathInfoArray.Count()) == AKRESULT.AK_Success)
        {
            for (var idxPath = (int)pathsParams.numValidPaths - 1; idxPath >= 0; --idxPath)
            {
                var path       = diffractionPathInfoArray[idxPath];
                var emitterPos = ConvertVector(pathsParams.emitterPos);
                var prevPt     = ConvertVector(pathsParams.listenerPos);

                if (path.nodeCount > 0)
                {
                    for (var idxSeg = 0; idxSeg < (int)path.nodeCount; ++idxSeg)
                    {
                        var pt = ConvertVector(path.GetNodes((uint)idxSeg));

                        UnityEngine.Debug.DrawLine(prevPt, pt, colorGreen);

                        float angle = path.GetAngles((uint)idxSeg) / UnityEngine.Mathf.PI;
                        if (angle > 0)
                        {
                            string angleStr = angle.ToString("0.#%");
                            DrawLabelInFrontOfCam(pt, angleStr, 100000, colorGreen);
                        }

                        prevPt = pt;
                    }

                    UnityEngine.Debug.DrawLine(prevPt, emitterPos, colorGreen);
                }
            }
        }
    }
Ejemplo n.º 2
0
        public void DebugDrawDiffraction(UnityEngine.GameObject gameObject)
        {
            var  listenerPosition = UnityEngine.Vector3.zero;
            var  emitterPosition  = UnityEngine.Vector3.zero;
            uint numValidPaths    = (uint)diffractionPathInfoArray.Count();

            if (AkSoundEngine.QueryDiffractionPaths(gameObject, ref listenerPosition, ref emitterPosition, diffractionPathInfoArray, out numValidPaths) != AKRESULT.AK_Success)
            {
                return;
            }

            for (var idxPath = (int)numValidPaths - 1; idxPath >= 0; --idxPath)
            {
                var path = diffractionPathInfoArray[idxPath];
                if (path.nodeCount <= 0)
                {
                    continue;
                }

                var prevPt = listenerPosition;

                for (var idxSeg = 0; idxSeg < (int)path.nodeCount; ++idxSeg)
                {
                    var pt = path.GetNodes((uint)idxSeg);
                    UnityEngine.Debug.DrawLine(prevPt, pt, colorGreen);

                    float angle = path.GetAngles((uint)idxSeg) / UnityEngine.Mathf.PI;
                    if (angle > 0)
                    {
                        string angleStr = angle.ToString("0.#%");
                        DrawLabelInFrontOfCam(pt, angleStr, 100000, colorGreen);
                    }

                    prevPt = pt;
                }

                UnityEngine.Debug.DrawLine(prevPt, emitterPosition, colorGreen);
            }
        }