mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 08:50:43 -05:00
In the end, Kaeno's fix by changing the main client collider's layer to `HighPolyCollider` is the only way I could fix it. Also made changes to avoid unnecessary physics collisions between other BTR colliders; these physics collisions can cause FPS drops especially for lower end PCs so this should provide a slight performance gain for them. I left in the commented-out collision debugger script I made to log collisions in case it's useful for future debugging purposes. Reviewed-on: SPT/Modules#142 Co-authored-by: Nympfonic <arys.steam@gmail.com> Co-committed-by: Nympfonic <arys.steam@gmail.com>
36 lines
951 B
C#
36 lines
951 B
C#
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}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|