Firstly, I would like to thank the developers at Rival Theory for working on this awesome, free AI Engine.
The problem I am experiencing is trying to programmatically detect other objects (which means I’m not using the BT interface). Here is what I have done:
1) Attach an Aspect to each object I want to detect.
2) Attached an AIRig component to each intelligent agent and defined each visual sensor appropriately.
3) Defined some basic behavior in a custom component:
public class VisualDetection : MonoBehaviour
public Transform target;
ai = gameObject.GetComponentInChildren<AIRig>();
detect = new DetectAction();
sensorName = new Expression();
aspectName = new Expression();
sensorName.ExpressionAsEntered = "FrontSensor";
aspectName.ExpressionAsEntered = "Infected";
detect.sensor = sensorName;
detect.aspect = aspectName;
detect.aspectObjectVariable = "SensedAgent";
Debug.Log (ai.AI.WorkingMemory.GetItem ("SensedAgent"));
if (ai.AI.WorkingMemory.GetItem("SensedAgent") != null)
Debug.Log ("GameObject Detected");
However, it doesn’t seem to work. Any solutions on how I can get it to work?