I have a bullet that moves really fast in a boomerang pattern. Ive enabled continuous dynamic detection for both the bullet and the target, but still the OnTriggerEnter only triggers like 80% of the time, what else can I change to make sure its 100%?
IEnumerator InitialMovement()
{
float elapsedTime = 0.0f;
while (elapsedTime < speed)
{
elapsedTime += Time.deltaTime;
float t = Mathf.Clamp01(elapsedTime / speed);
float curveValue = initialSpeed.Evaluate(t);
rb.MovePosition(Vector3.Lerp(start, end, curveValue));
yield return null;
}
StartCoroutine(ReturnMovement());
}
IEnumerator ReturnMovement()
{
float elapsedTime = 0.0f;
while (elapsedTime < speed)
{
elapsedTime += Time.deltaTime;
float t = Mathf.Clamp01(elapsedTime / speed);
float curveValue = returnSpeed.Evaluate(t);
rb.MovePosition(Vector3.Lerp(end, start, curveValue));
yield return null;
}
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.TryGetComponent(out Health health))
{
health.TakeDamage(10, gameObject);
}
}