Skip to content

Commit

Permalink
Merge pull request #327 from GothicVRProject/bugfix/waypoint-freepoin…
Browse files Browse the repository at this point in the history
…t-fix

bugfix(RootCollisionHandler): Ignore colliders that are not freepoints
  • Loading branch information
JucanAndreiDaniel authored Mar 27, 2024
2 parents 0c5578c + b6878a3 commit c793117
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Assets/GothicVR/Scripts/Npc/RootCollisionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ private void OnCollisionExit(Collision coll)
properties.currentAction?.OnCollisionExit(coll);

// If NPC walks out of a FreePoint, it gets freed.
if (!coll.gameObject.name.StartsWithIgnoreCase("FP_"))
return;

coll.gameObject.GetComponent<VobSpotProperties>().fp.IsLocked = false;
// Ignore Waypoints from WayNet as there are 4 of them which starts with FP_ but are waypoints not free points.
if (coll.gameObject.name.StartsWithIgnoreCase("FP_") &&
coll.gameObject.TryGetComponent<VobSpotProperties>(out var vobSpotProperties))
vobSpotProperties.fp.IsLocked = false;
}

/// <summary>
Expand All @@ -35,10 +35,10 @@ private void OnTriggerExit(Collider coll)
properties.currentAction?.OnTriggerExit(coll);

// If NPC walks out of a FreePoint, it gets freed.
if (!coll.gameObject.name.StartsWithIgnoreCase("FP_"))
return;

coll.gameObject.GetComponent<VobSpotProperties>().fp.IsLocked = false;
// Ignore Waypoints from WayNet as there are 4 of them which starts with FP_ but are waypoints not free points.
if (coll.gameObject.name.StartsWithIgnoreCase("FP_") &&
coll.gameObject.TryGetComponent<VobSpotProperties>(out var vobSpotProperties))
vobSpotProperties.fp.IsLocked = false;
}

private void Update()
Expand All @@ -62,6 +62,5 @@ private void Update()
// Empty physics based diff. Next frame physics will be recalculated.
collisionTransform.localPosition = Vector3.zero;
}

}
}
}

0 comments on commit c793117

Please sign in to comment.