Hi All,
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:
using UnityEngine;
using System.Collections;
using RAIN.Core;
using RAIN.BehaviorTrees.Actions;
using RAIN.Representation;
public class VisualDetection : MonoBehaviour
{
AIRig ai;
DetectAction detect;
Expression sensorName;
Expression aspectName;
public Transform target;
void Start()
{
ai = gameObject.GetComponentInChildren<AIRig>();
detect = new DetectAction();
sensorName = new Expression();
aspectName = new Expression();
}
void Update()
{
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?
Thanks in advance