implementation of drecon in unity 2022 lts forked from: https://github.com/joanllobera/marathon-envs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
705 B

9 months ago
using UnityEngine;
namespace Unity.MLAgents
{
public class SendOnCollisionTrigger : MonoBehaviour
{
void OnCollisionEnter(Collision other)
{
// Messenger.
var otherGameobject = other.gameObject;
var marathonAgent = otherGameobject.GetComponentInParent<MarathonAgent>();
if (marathonAgent != null)
marathonAgent.OnTerrainCollision(otherGameobject, this.gameObject);
var iOnTerrainCollision = otherGameobject.GetComponentInParent<IOnTerrainCollision>();
if (iOnTerrainCollision != null)
iOnTerrainCollision.OnTerrainCollision(otherGameobject, this.gameObject);
}
}
}