Skip to content
Snippets Groups Projects
Commit 56ccbbc7 authored by gawen.ackerman's avatar gawen.ackerman :robot:
Browse files

FIX : Road Generator issue

parent 6c14d0a3
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -29,8 +29,8 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.27500153, y: -81.25, z: 210.9005}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_LocalScale: {x: 2.5, y: 2.5, z: 2.5}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
......@@ -260,21 +260,32 @@ public class RoadGenerator : MonoBehaviour
Quaternion rotation = partCollider.transform.rotation;
Collider[] overlaps = Physics.OverlapBox(worldCenter, halfExtents, rotation);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"[{Time.time}] OverlapBox of {partCollider.gameObject.name} hit the following colliders:");
foreach (var col in overlaps)
{
if (col.CompareTag("RoadPart")) OverlapBoxVisualizer.AddBox(roadPart, worldCenter, halfExtents, rotation, 9999f, Color.red);
if (roadPart.name.StartsWith("Up") || roadPart.name.StartsWith("Down"))
{
// CHECK THE CHILD COLLIDER (they do not have the tag RoadPart, but the GO Up and Down yes
// Use for the special case of the ramp Up and Down with 2 colliders
if (col.gameObject.name.StartsWith("Up") || col.gameObject.name.StartsWith("Down"))
{
if (col.transform.parent.gameObject.CompareTag("RoadPart") && col.transform.parent.gameObject != roadPart)
{
isColliding = true;
Debug.Log($"{roadPart.name} collides with {col.gameObject.name}");
stringBuilder.AppendLine($"[{Time.time}] - {col.gameObject.name}");
break;
}
}
if (col.gameObject != roadPart && col.CompareTag("RoadPart"))
if ((col.gameObject != roadPart && col.CompareTag("RoadPart")))
{
isColliding = true;
Debug.Log($"{roadPart.name} collides with {col.gameObject.name}");
stringBuilder.AppendLine($"[{Time.time}] - {col.gameObject.name}");
break;
}
}
print(stringBuilder.ToString());
if (isColliding) break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment