Skip to content

Commit f02c37c

Browse files
committed
Disable triangle rendering when triangleIndex is -1 to avoid Null Pointer for Convex MeshCollider
1 parent b45021c commit f02c37c

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

Assets/Scripts/Runtime/PhysicsSensorUtils.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ public static void DrawNormal(RaycastHit hit)
8282
public static void HighlightMeshVertices(RaycastHit hit)
8383
{
8484
var meshCollider = hit.collider as MeshCollider;
85+
8586
if (meshCollider != null)
8687
{
88+
// Convex
89+
if(hit.triangleIndex == -1)
90+
return;
91+
8792
var mesh = meshCollider.sharedMesh;
8893

8994
if (mesh != lastInspectedMesh)

README-ru.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,6 @@ Unity **2018.1** или выше
102102
- Улучшение: Форматирование для документации, Всплывающие окошки в с документацией у полей
103103
- Улучшение: Обновление стиля окошка с информацией о попадании, также теперь он не обрезается о границу окна
104104
- Улучшение: Кэширование вершин для отображения треугольников
105-
- Улучшение: "Lazy Allocation" теперь только для чтения, нельзя анимировать и можно проставить только из инспектора, так как его значение используется только при инициализации компонента
105+
- Улучшение: "Lazy Allocation" теперь только для чтения, нельзя анимировать и можно проставить только из инспектора, так как его значение используется только при инициализации компонента
106+
* 1.1.4
107+
- Багфикс: Out of bounds exception при попытке отрисовать треугольник на Convex MeshCollider (при таком случае, triangleIndex == -1)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ Otherwise, you can just copy files from `Assets/Scripts/Runtime` to your project
119119
- Improvement: Documentation formatting fixes, Tooltips for editor
120120
- Improvement: Hit information window style update, also now it doesn't clip out of view
121121
- Improvement: Vertex caching for hit information overlay
122-
- Improvement: "Lazy Allocation" now readonly, non keyable and can be set only from inspector, because it is used only during component initialization
122+
- Improvement: "Lazy Allocation" now readonly, non keyable and can be set only from inspector, because it is used only during component initialization
123+
* 1.1.4
124+
- Bugfix: Out of bounds exception when triangle highlight gizmo tries to display triangle on convex mesh (triangleIndex is -1 in this case)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ru.threedisevenzeror.sensorkit",
33
"displayName": "Sensor Kit",
4-
"version": "1.1.3",
4+
"version": "1.1.4",
55
"unity": "2018.1",
66
"description": "Collection of wrapped Physics.* methods with ability to place casts in scene and configure parameters without hardcoding values",
77
"keywords": ["Physics", "Raycast", "Utility"],

0 commit comments

Comments
 (0)