public override void Start(RAIN.Core.AI ai) { detected = RAIN.Motion.MoveLookTarget.GetTargetFromVariable(ai.WorkingMemory, "nextPosition"); Debug.Log(detected.Position); componentGetter = ai.Body.GetComponent <GetComponents> (); moverAgent = componentGetter.m_agent; //moverAgent.destination = detected.Position; base.Start(ai); }
public override void Start(RAIN.Core.AI ai) { detected = RAIN.Motion.MoveLookTarget.GetTargetFromVariable(ai.WorkingMemory, "nextPosition"); Debug.Log(detected.Position); componentGetter = ai.Body.GetComponent<GetComponents> (); moverAgent = componentGetter.m_agent; //moverAgent.destination = detected.Position; base.Start(ai); }
public override ActionResult Execute(AI ai) { if (!ai.WorkingMemory.ItemExists("patrolTargetVec")) { RAIN.Motion.MoveLookTarget mlt = ai.WorkingMemory.GetItem("patrolTarget").GetValue <RAIN.Motion.MoveLookTarget> (); ai.WorkingMemory.SetItem("patrolTargetVec", mlt.Position); } moveToPos = ai.WorkingMemory.GetItem("patrolTargetVec").GetValue <Vector3> (); // Debug.Log (moveToPos); ai.Motor.moveTarget.VectorTarget = moveToPos; ai.Motor.Allow3DRotation = false; if (!ai.Motor.Move()) { return(ActionResult.RUNNING); } else { ai.WorkingMemory.RemoveItem("patrolTargetVec"); return(ActionResult.SUCCESS); } }