0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.Custom/BTR/CollisionDebugger.cs

36 lines
951 B
C#
Raw Normal View History

using EFT.UI;
using UnityEngine;
namespace SPT.Custom.BTR
{
public class CollisionDebugger : MonoBehaviour
{
private int _resetFrame = 10;
private int _frame = 0;
private void Update()
{
_frame = (_frame + 1) % _resetFrame;
}
private void OnCollisionEnter(Collision collision)
{
foreach (var contact in collision.contacts)
{
ConsoleScreen.LogWarning($"Collision between {gameObject.name} and {contact.otherCollider.gameObject.name}");
}
}
private void OnCollisionStay(Collision collision)
{
if (_frame == 0)
{
foreach (var contact in collision.contacts)
{
ConsoleScreen.LogWarning($"Collision between {gameObject.name} and {contact.otherCollider.gameObject.name}");
}
}
}
}
}