![JAR search and dependency download from the Maven repository](/logo.png)
org.recast4j.detour.crowd.CrowdAgent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detour-crowd Show documentation
Show all versions of detour-crowd Show documentation
Navigation Mesh Construction and Path-finding Toolkit.
The newest version!
/*
Copyright (c) 2009-2010 Mikko Mononen [email protected]
recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected]
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package org.recast4j.detour.crowd;
import static org.recast4j.detour.DetourCommon.*;
import java.util.ArrayList;
import java.util.List;
import org.recast4j.detour.NavMeshQuery;
import org.recast4j.detour.StraightPathItem;
import org.recast4j.detour.crowd.Crowd.CrowdNeighbour;
/// Represents an agent managed by a #dtCrowd object.
/// @ingroup crowd
public class CrowdAgent {
/// The type of navigation mesh polygon the agent is currently traversing.
/// @ingroup crowd
public enum CrowdAgentState {
DT_CROWDAGENT_STATE_INVALID, /// < The agent is not in a valid state.
DT_CROWDAGENT_STATE_WALKING, /// < The agent is traversing a normal navigation mesh polygon.
DT_CROWDAGENT_STATE_OFFMESH, /// < The agent is traversing an off-mesh connection.
};
public enum MoveRequestState {
DT_CROWDAGENT_TARGET_NONE,
DT_CROWDAGENT_TARGET_FAILED,
DT_CROWDAGENT_TARGET_VALID,
DT_CROWDAGENT_TARGET_REQUESTING,
DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE,
DT_CROWDAGENT_TARGET_WAITING_FOR_PATH,
DT_CROWDAGENT_TARGET_VELOCITY,
};
public final long idx;
/// The type of mesh polygon the agent is traversing. (See: #CrowdAgentState)
public CrowdAgentState state;
/// True if the agent has valid path (targetState == DT_CROWDAGENT_TARGET_VALID) and the path does not lead to the
/// requested position, else false.
boolean partial;
/// The path corridor the agent is using.
public PathCorridor corridor;
/// The local boundary data for the agent.
public LocalBoundary boundary;
/// Time since the agent's path corridor was optimized.
float topologyOptTime;
/// The known neighbors of the agent.
public List neis = new ArrayList<>();
/// The desired speed.
float desiredSpeed;
public float[] npos = new float[3]; /// < The current agent position. [(x, y, z)]
float[] disp = new float[3]; /// < A temporary value used to accumulate agent displacement during iterative
/// collision resolution. [(x, y, z)]
public float[] dvel = new float[3]; /// < The desired velocity of the agent. Based on the current path, calculated
/// from
/// scratch each frame. [(x, y, z)]
float[] nvel = new float[3]; /// < The desired velocity adjusted by obstacle avoidance, calculated from scratch each
/// frame. [(x, y, z)]
public float[] vel = new float[3]; /// < The actual velocity of the agent. The change from nvel -> vel is
/// constrained by max acceleration. [(x, y, z)]
/// The agent's configuration parameters.
public CrowdAgentParams params;
/// The local path corridor corners for the agent.
public List corners = new ArrayList<>();
public MoveRequestState targetState; /// < State of the movement request.
public long targetRef; /// < Target polyref of the movement request.
public float[] targetPos = new float[3]; /// < Target position of the movement request (or velocity in case of
/// DT_CROWDAGENT_TARGET_VELOCITY).
PathQueryResult targetPathQueryResult; /// < Path finder query
boolean targetReplan; /// < Flag indicating that the current path is being replanned.
float targetReplanTime; ///
© 2015 - 2025 Weber Informatics LLC | Privacy Policy