public SteeringAlgorithm(Targeter tag) { this.targeter = tag; maxConstraintSteps = 10.0f; //alterar dps consoante validPath = false; goal = new Goal(); smoothpath = new GlobalPath(); this.goal.updateChannels(targeter.getGoal()); }
public GlobalPath decompose(DynamicCharacter character, Goal goal) { this.aStarPathFinding.InitializePathfindingSearch(character.KinematicData.position, goal.position); if (this.aStarPathFinding.InProgress) { var finished = this.aStarPathFinding.Search(out this.currentSolution, true); if (finished && this.currentSolution != null) { //lets smooth out the Path this.currentSmoothedSolution = StringPullingPathSmoothing.SmoothPath(character.KinematicData, this.currentSolution); currentSmoothedSolution.CalculateLocalPathsFromPathPositions(character.KinematicData.position); return this.currentSmoothedSolution; } } return null; }
public void updateChannels(Goal goal) { if (goal.hasPosition) this.position = goal.position; }
public Targeter(Goal endPosition) { this.goal = endPosition; this.goal.hasPosition = true; }