3 static const string PORT_ENTITY =
"EntityWithSplineIn";
4 static const string PORT_POSITION =
"PositionOut";
6 protected static ref TStringArray s_aVarsIn = {
9 override TStringArray GetVariablesIn()
14 protected static ref TStringArray s_aVarsOut = {
17 override TStringArray GetVariablesOut()
22 private int m_iLastIndex;
23 private ref array <vector> m_aOffsetPath;
24 private vector m_vOrigin;
25 private bool m_bShouldFail;
28 protected override void OnInit(AIAgent owner)
31 if(!GetVariableIn(PORT_ENTITY,ent))
32 ent = owner.GetControlledEntity();
34 m_aOffsetPath =
new array <vector>;
36 if (ent.GetChildren())
38 IEntity entPoly = ent.GetChildren();
39 PolylineShapeEntity polyline = PolylineShapeEntity.Cast(entPoly);
41 while (!polyline && entPoly)
43 entPoly = entPoly.GetSibling();
44 polyline = PolylineShapeEntity.Cast(entPoly);
52 m_vOrigin = polyline.GetOrigin();
54 polyline.GetPointsPositions(m_aOffsetPath);
58 protected override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
61 return ENodeResult.FAIL;
64 vector positionOut = m_aOffsetPath[
m_iLastIndex] + m_vOrigin;
66 SetVariableOut(PORT_POSITION,positionOut);
68 return ENodeResult.SUCCESS;
71 protected override bool VisibleInPalette()
76 protected override string GetOnHoverDescription()
78 return "BT node for returning position on spline that is hierarchical child of provided entity. Each tick next point on spline is taken.";