Ejemplo n.º 1
0
 private void DrawContacts()
 {
     if (PhysicsVisualizationSettings.showContacts)
     {
         PhysicsDebugDraw.GetPooledContacts();
     }
 }
Ejemplo n.º 2
0
        public void OnEnable()
        {
            m_ShowColliderTypeFoldout = new SavedBool("PhysicsDebugWindow.ShowColliderType", false);
            m_CurrentTab = new SavedInt("PhysicsDebugWindow.CurrentTab", 0);
            m_Collumns   = new SavedInt("PhysicsDebugWindow.Collumns", 1);

            SceneView.duringSceneGui                 += OnSceneGUI;
            Selection.selectionChanged               += UpdateSelection;
            EditorSceneManager.sceneClosed           += OnSceneClose;
            EditorSceneManager.sceneOpened           += OnSceneOpen;
            EditorApplication.playModeStateChanged   += PlayModeStateChanged;
            PhysicsDebugDraw.OnDrawPooledContacts    += DrawContacts_Internal;
            PhysicsDebugDraw.OnRetrievePooledQueries += OnQueriesRetrieved;
            PhysicsDebugDraw.BeforeSimulate          += BeforeSimulate;
            SetPickingEnabled(PhysicsVisualizationSettings.showCollisionGeometry &&
                              PhysicsVisualizationSettings.enableMouseSelect);

            LoadDictionary();
            ClearInvalidObjects();
            UpdateSelection();

            PhysicsDebugDraw.ClearAllPools();

            wantsLessLayoutEvents = true;
        }
Ejemplo n.º 3
0
        private void Update()
        {
            bool canFetch = s_Window != null && PhysicsVisualizationSettings.GetQueryFilterState(PhysicsVisualizationSettings.QueryFilter.ShowQueries);

            if (canFetch && m_SimulationOccured)
            {
                m_ShapesToDraw.Clear();
                PhysicsDebugDraw.GetPooledQueries();
                m_SimulationOccured = false;
            }
        }
Ejemplo n.º 4
0
        public void OnDisable()
        {
            SceneView.duringSceneGui                 -= OnSceneGUI;
            Selection.selectionChanged               -= UpdateSelection;
            EditorSceneManager.sceneClosed           -= OnSceneClose;
            EditorSceneManager.sceneOpened           -= OnSceneOpen;
            EditorApplication.playModeStateChanged   -= PlayModeStateChanged;
            PhysicsDebugDraw.OnDrawPooledContacts    -= DrawContacts_Internal;
            PhysicsDebugDraw.OnRetrievePooledQueries -= OnQueriesRetrieved;
            PhysicsDebugDraw.BeforeSimulate          -= BeforeSimulate;
            SetPickingEnabled(false);

            SaveDictionary();
            ClearInvalidObjects();

            PhysicsDebugDraw.ClearAllPools();
        }
Ejemplo n.º 5
0
 private void ClearAllPoolsAndStoredQueries()
 {
     PhysicsDebugDraw.ClearAllPools();
     ClearQueryShapes();
 }
Ejemplo n.º 6
0
        private void DrawContacts_Internal(NativeArray <PhysicsDebugDraw.VisContactPoint> array)
        {
            var useRandomColor = PhysicsVisualizationSettings.useVariedContactColors;
            var impulseColor   = useRandomColor ? Color.black : PhysicsVisualizationSettings.contactImpulseColor;

            for (int i = 0; i < array.Length; i++)
            {
                bool passedFiltering = (!PhysicsVisualizationSettings.useContactFiltering || PhysicsDebugDraw.IsContactVisualised(array[i].otherCollider));
                if (passedFiltering && IsContactSeenByCamera(array[i].point))
                {
                    DrawSingleCollision(array[i], impulseColor, useRandomColor);
                }
            }
        }
Ejemplo n.º 7
0
 private void OnSceneOpen(Scene scene, OpenSceneMode mode)
 {
     PhysicsDebugDraw.UpdateFilter();
 }
Ejemplo n.º 8
0
 private void OnSceneClose(Scene scene)
 {
     ClearInvalidObjects();
     PhysicsDebugDraw.UpdateFilter();
 }