Overlapping-on-load receivers are still broken
tracked
SenkyDragon
If an overlapping sender and proximity receiver are initially disabled, but then immediately enabled using an animation, the receiver will report 0 until it is removed and then reintroduced to the sender.
This bug used to exist for all receivers on load, and was supposedly "fixed" previously, but still persists in this more limited case.
This bug is very easy to accidentally trigger, as if the sender and receiver are within a normally-off toggle, and the toggle is turned on, changing your avatar's scale causes the issue.
Log In
_
_tau_
updated the status to
tracked
SenkyDragon
I spent some more time digging on this, and found the actual bug. If a contact is turned off and back on within the same frame, all existing collisions are dropped and not properly recreated. Presumably this happens in-game during avatar scaling, and possibly other edge cases, which is why it occurs periodically.
It looks like OnReenableInCollisionScene was originally written to handle this "cancelled removal" situation, but it only sets the parameter value once, and doesn't actually rebuild the collision list, so the next tick there are no active collisions and the value becomes zero.
Here's a reproduction. Add the component to a gameobject in play mode, and it should log 1,1,1, but instead it logs 1,0,1.
using System.Collections;
using UnityEngine;
using VRC.Dynamics;
using VRC.SDK3.Dynamics.Contact.Components;
public class ContactOverlapBug : MonoBehaviour {
IEnumerator Start() {
var s = new GameObject("Sender").AddComponent<VRCContactSender>();
var r = new GameObject("Receiver").AddComponent<VRCContactReceiver>();
s.transform.SetParent(transform, false);
r.transform.SetParent(transform, false);
s.allowInit = r.allowInit = true;
s.radius = r.radius = 0.2f;
s.collisionTags.Add("Repro");
r.collisionTags.Add("Repro");
r.receiverType = ContactReceiver.ReceiverType.Proximity;
yield return new WaitForSeconds(0.2f);
Debug.Log("Before: " + r.paramValue); // 1
r.enabled = false;
transform.localScale *= 2;
r.enabled = true;
yield return new WaitForSeconds(0.5f);
Debug.Log("After receiver turns off and back on: " + r.paramValue);
s.transform.position = r.transform.position + Vector3.one * 10;
yield return new WaitForSeconds(0.2f);
s.transform.position = r.transform.position;
yield return new WaitForSeconds(0.2f);
Debug.Log("After receiver is moved and moved back: " + r.paramValue);
}
}
Alice Luna Star
Please fix this issue ASAP!