mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #64354 from Mickeon/rename-navigation-distance
This commit is contained in:
commit
af88438c71
@ -126,7 +126,7 @@
|
||||
<member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1">
|
||||
A bitfield determining what navigation layers of navigation regions this agent will use to calculate path. Changing it runtime will clear current navigation path and generate new one, according to new navigation layers.
|
||||
</member>
|
||||
<member name="neighbor_dist" type="float" setter="set_neighbor_dist" getter="get_neighbor_dist" default="500.0">
|
||||
<member name="neighbor_distance" type="float" setter="set_neighbor_distance" getter="get_neighbor_distance" default="500.0">
|
||||
The distance to search for other agents.
|
||||
</member>
|
||||
<member name="path_desired_distance" type="float" setter="set_path_desired_distance" getter="get_path_desired_distance" default="1.0">
|
||||
@ -136,7 +136,7 @@
|
||||
The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
|
||||
</member>
|
||||
<member name="radius" type="float" setter="set_radius" getter="get_radius" default="10.0">
|
||||
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_dist]).
|
||||
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_distance]).
|
||||
Does not affect normal pathfinding. To change an actor's pathfinding radius bake [NavigationMesh] resources with a different [member NavigationMesh.agent_radius] property and use different navigation maps for each actor size.
|
||||
</member>
|
||||
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0">
|
||||
|
@ -132,7 +132,7 @@
|
||||
<member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1">
|
||||
A bitfield determining what navigation layers of navigation regions this NavigationAgent will use to calculate path. Changing it runtime will clear current navigation path and generate new one, according to new navigation layers.
|
||||
</member>
|
||||
<member name="neighbor_dist" type="float" setter="set_neighbor_dist" getter="get_neighbor_dist" default="50.0">
|
||||
<member name="neighbor_distance" type="float" setter="set_neighbor_distance" getter="get_neighbor_distance" default="50.0">
|
||||
The distance to search for other agents.
|
||||
</member>
|
||||
<member name="path_desired_distance" type="float" setter="set_path_desired_distance" getter="get_path_desired_distance" default="1.0">
|
||||
@ -142,7 +142,7 @@
|
||||
The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
|
||||
</member>
|
||||
<member name="radius" type="float" setter="set_radius" getter="get_radius" default="1.0">
|
||||
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_dist]).
|
||||
The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_distance]).
|
||||
Does not affect normal pathfinding. To change an actor's pathfinding radius bake [NavigationMesh] resources with a different [member NavigationMesh.agent_radius] property and use different navigation maps for each actor size.
|
||||
</member>
|
||||
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0">
|
||||
|
@ -72,10 +72,10 @@
|
||||
Sets the maximum speed of the agent. Must be positive.
|
||||
</description>
|
||||
</method>
|
||||
<method name="agent_set_neighbor_dist" qualifiers="const">
|
||||
<method name="agent_set_neighbor_distance" qualifiers="const">
|
||||
<return type="void" />
|
||||
<param index="0" name="agent" type="RID" />
|
||||
<param index="1" name="dist" type="float" />
|
||||
<param index="1" name="distance" type="float" />
|
||||
<description>
|
||||
Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
|
||||
</description>
|
||||
|
@ -72,10 +72,10 @@
|
||||
Sets the maximum speed of the agent. Must be positive.
|
||||
</description>
|
||||
</method>
|
||||
<method name="agent_set_neighbor_dist" qualifiers="const">
|
||||
<method name="agent_set_neighbor_distance" qualifiers="const">
|
||||
<return type="void" />
|
||||
<param index="0" name="agent" type="RID" />
|
||||
<param index="1" name="dist" type="float" />
|
||||
<param index="1" name="distance" type="float" />
|
||||
<description>
|
||||
Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
|
||||
</description>
|
||||
|
@ -453,11 +453,11 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
|
||||
}
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_neighbor_dist, RID, p_agent, real_t, p_dist) {
|
||||
COMMAND_2(agent_set_neighbor_distance, RID, p_agent, real_t, p_distance) {
|
||||
RvoAgent *agent = agent_owner.get_or_null(p_agent);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->neighborDist_ = p_dist;
|
||||
agent->get_agent()->neighborDist_ = p_distance;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) {
|
||||
|
@ -135,7 +135,7 @@ public:
|
||||
virtual RID agent_create() const override;
|
||||
COMMAND_2(agent_set_map, RID, p_agent, RID, p_map);
|
||||
virtual RID agent_get_map(RID p_agent) const override;
|
||||
COMMAND_2(agent_set_neighbor_dist, RID, p_agent, real_t, p_dist);
|
||||
COMMAND_2(agent_set_neighbor_distance, RID, p_agent, real_t, p_distance);
|
||||
COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count);
|
||||
COMMAND_2(agent_set_time_horizon, RID, p_agent, real_t, p_time);
|
||||
COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius);
|
||||
|
@ -49,8 +49,8 @@ void NavigationAgent2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &NavigationAgent2D::set_radius);
|
||||
ClassDB::bind_method(D_METHOD("get_radius"), &NavigationAgent2D::get_radius);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_neighbor_dist", "neighbor_dist"), &NavigationAgent2D::set_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("get_neighbor_dist"), &NavigationAgent2D::get_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("set_neighbor_distance", "neighbor_distance"), &NavigationAgent2D::set_neighbor_distance);
|
||||
ClassDB::bind_method(D_METHOD("get_neighbor_distance"), &NavigationAgent2D::get_neighbor_distance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_max_neighbors", "max_neighbors"), &NavigationAgent2D::set_max_neighbors);
|
||||
ClassDB::bind_method(D_METHOD("get_max_neighbors"), &NavigationAgent2D::get_max_neighbors);
|
||||
@ -96,7 +96,7 @@ void NavigationAgent2D::_bind_methods() {
|
||||
ADD_GROUP("Avoidance", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "avoidance_enabled"), "set_avoidance_enabled", "get_avoidance_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.1,500,0.01,suffix:px"), "set_radius", "get_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "neighbor_dist", PROPERTY_HINT_RANGE, "0.1,100000,0.01,suffix:px"), "set_neighbor_dist", "get_neighbor_dist");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "neighbor_distance", PROPERTY_HINT_RANGE, "0.1,100000,0.01,suffix:px"), "set_neighbor_distance", "get_neighbor_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_neighbors", PROPERTY_HINT_RANGE, "1,10000,1"), "set_max_neighbors", "get_max_neighbors");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_horizon", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:s"), "set_time_horizon", "get_time_horizon");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_speed", PROPERTY_HINT_RANGE, "0.1,100000,0.01,suffix:px/s"), "set_max_speed", "get_max_speed");
|
||||
@ -173,7 +173,7 @@ void NavigationAgent2D::_notification(int p_what) {
|
||||
|
||||
NavigationAgent2D::NavigationAgent2D() {
|
||||
agent = NavigationServer2D::get_singleton()->agent_create();
|
||||
set_neighbor_dist(500.0);
|
||||
set_neighbor_distance(500.0);
|
||||
set_max_neighbors(10);
|
||||
set_time_horizon(20.0);
|
||||
set_radius(10.0);
|
||||
@ -275,9 +275,9 @@ void NavigationAgent2D::set_radius(real_t p_radius) {
|
||||
NavigationServer2D::get_singleton()->agent_set_radius(agent, radius);
|
||||
}
|
||||
|
||||
void NavigationAgent2D::set_neighbor_dist(real_t p_dist) {
|
||||
neighbor_dist = p_dist;
|
||||
NavigationServer2D::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist);
|
||||
void NavigationAgent2D::set_neighbor_distance(real_t p_distance) {
|
||||
neighbor_distance = p_distance;
|
||||
NavigationServer2D::get_singleton()->agent_set_neighbor_distance(agent, neighbor_distance);
|
||||
}
|
||||
|
||||
void NavigationAgent2D::set_max_neighbors(int p_count) {
|
||||
|
@ -50,7 +50,7 @@ class NavigationAgent2D : public Node {
|
||||
real_t path_desired_distance = 1.0;
|
||||
real_t target_desired_distance = 1.0;
|
||||
real_t radius = 0.0;
|
||||
real_t neighbor_dist = 0.0;
|
||||
real_t neighbor_distance = 0.0;
|
||||
int max_neighbors = 0;
|
||||
real_t time_horizon = 0.0;
|
||||
real_t max_speed = 0.0;
|
||||
@ -110,9 +110,9 @@ public:
|
||||
return radius;
|
||||
}
|
||||
|
||||
void set_neighbor_dist(real_t p_dist);
|
||||
real_t get_neighbor_dist() const {
|
||||
return neighbor_dist;
|
||||
void set_neighbor_distance(real_t p_distance);
|
||||
real_t get_neighbor_distance() const {
|
||||
return neighbor_distance;
|
||||
}
|
||||
|
||||
void set_max_neighbors(int p_count);
|
||||
|
@ -135,7 +135,7 @@ TypedArray<String> NavigationObstacle2D::get_configuration_warnings() const {
|
||||
}
|
||||
|
||||
void NavigationObstacle2D::initialize_agent() {
|
||||
NavigationServer2D::get_singleton()->agent_set_neighbor_dist(agent, 0.0);
|
||||
NavigationServer2D::get_singleton()->agent_set_neighbor_distance(agent, 0.0);
|
||||
NavigationServer2D::get_singleton()->agent_set_max_neighbors(agent, 0);
|
||||
NavigationServer2D::get_singleton()->agent_set_time_horizon(agent, 0.0);
|
||||
NavigationServer2D::get_singleton()->agent_set_max_speed(agent, 0.0);
|
||||
|
@ -53,8 +53,8 @@ void NavigationAgent3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_ignore_y", "ignore"), &NavigationAgent3D::set_ignore_y);
|
||||
ClassDB::bind_method(D_METHOD("get_ignore_y"), &NavigationAgent3D::get_ignore_y);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_neighbor_dist", "neighbor_dist"), &NavigationAgent3D::set_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("get_neighbor_dist"), &NavigationAgent3D::get_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("set_neighbor_distance", "neighbor_distance"), &NavigationAgent3D::set_neighbor_distance);
|
||||
ClassDB::bind_method(D_METHOD("get_neighbor_distance"), &NavigationAgent3D::get_neighbor_distance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_max_neighbors", "max_neighbors"), &NavigationAgent3D::set_max_neighbors);
|
||||
ClassDB::bind_method(D_METHOD("get_max_neighbors"), &NavigationAgent3D::get_max_neighbors);
|
||||
@ -101,7 +101,7 @@ void NavigationAgent3D::_bind_methods() {
|
||||
ADD_GROUP("Avoidance", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "avoidance_enabled"), "set_avoidance_enabled", "get_avoidance_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.1,100,0.01,suffix:m"), "set_radius", "get_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "neighbor_dist", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:m"), "set_neighbor_dist", "get_neighbor_dist");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "neighbor_distance", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:m"), "set_neighbor_distance", "get_neighbor_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_neighbors", PROPERTY_HINT_RANGE, "1,10000,1"), "set_max_neighbors", "get_max_neighbors");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_horizon", PROPERTY_HINT_RANGE, "0.01,100,0.01,suffix:s"), "set_time_horizon", "get_time_horizon");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_speed", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:m/s"), "set_max_speed", "get_max_speed");
|
||||
@ -179,7 +179,7 @@ void NavigationAgent3D::_notification(int p_what) {
|
||||
|
||||
NavigationAgent3D::NavigationAgent3D() {
|
||||
agent = NavigationServer3D::get_singleton()->agent_create();
|
||||
set_neighbor_dist(50.0);
|
||||
set_neighbor_distance(50.0);
|
||||
set_max_neighbors(10);
|
||||
set_time_horizon(5.0);
|
||||
set_radius(1.0);
|
||||
@ -291,9 +291,9 @@ void NavigationAgent3D::set_ignore_y(bool p_ignore_y) {
|
||||
NavigationServer3D::get_singleton()->agent_set_ignore_y(agent, ignore_y);
|
||||
}
|
||||
|
||||
void NavigationAgent3D::set_neighbor_dist(real_t p_dist) {
|
||||
neighbor_dist = p_dist;
|
||||
NavigationServer3D::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist);
|
||||
void NavigationAgent3D::set_neighbor_distance(real_t p_distance) {
|
||||
neighbor_distance = p_distance;
|
||||
NavigationServer3D::get_singleton()->agent_set_neighbor_distance(agent, neighbor_distance);
|
||||
}
|
||||
|
||||
void NavigationAgent3D::set_max_neighbors(int p_count) {
|
||||
|
@ -52,7 +52,7 @@ class NavigationAgent3D : public Node {
|
||||
real_t radius = 0.0;
|
||||
real_t navigation_height_offset = 0.0;
|
||||
bool ignore_y = false;
|
||||
real_t neighbor_dist = 0.0;
|
||||
real_t neighbor_distance = 0.0;
|
||||
int max_neighbors = 0;
|
||||
real_t time_horizon = 0.0;
|
||||
real_t max_speed = 0.0;
|
||||
@ -122,9 +122,9 @@ public:
|
||||
return ignore_y;
|
||||
}
|
||||
|
||||
void set_neighbor_dist(real_t p_dist);
|
||||
real_t get_neighbor_dist() const {
|
||||
return neighbor_dist;
|
||||
void set_neighbor_distance(real_t p_distance);
|
||||
real_t get_neighbor_distance() const {
|
||||
return neighbor_distance;
|
||||
}
|
||||
|
||||
void set_max_neighbors(int p_count);
|
||||
|
@ -141,7 +141,7 @@ TypedArray<String> NavigationObstacle3D::get_configuration_warnings() const {
|
||||
}
|
||||
|
||||
void NavigationObstacle3D::initialize_agent() {
|
||||
NavigationServer3D::get_singleton()->agent_set_neighbor_dist(agent, 0.0);
|
||||
NavigationServer3D::get_singleton()->agent_set_neighbor_distance(agent, 0.0);
|
||||
NavigationServer3D::get_singleton()->agent_set_max_neighbors(agent, 0);
|
||||
NavigationServer3D::get_singleton()->agent_set_time_horizon(agent, 0.0);
|
||||
NavigationServer3D::get_singleton()->agent_set_max_speed(agent, 0.0);
|
||||
|
@ -237,7 +237,7 @@ void NavigationServer2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer2D::agent_create);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer2D::agent_set_map);
|
||||
ClassDB::bind_method(D_METHOD("agent_get_map", "agent"), &NavigationServer2D::agent_get_map);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &NavigationServer2D::agent_set_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_neighbor_distance", "agent", "distance"), &NavigationServer2D::agent_set_neighbor_distance);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer2D::agent_set_max_neighbors);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &NavigationServer2D::agent_set_time_horizon);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer2D::agent_set_radius);
|
||||
@ -323,7 +323,7 @@ RID NavigationServer2D::agent_create() const {
|
||||
|
||||
void FORWARD_2_C(agent_set_map, RID, p_agent, RID, p_map, rid_to_rid, rid_to_rid);
|
||||
|
||||
void FORWARD_2_C(agent_set_neighbor_dist, RID, p_agent, real_t, p_dist, rid_to_rid, real_to_real);
|
||||
void FORWARD_2_C(agent_set_neighbor_distance, RID, p_agent, real_t, p_dist, rid_to_rid, real_to_real);
|
||||
|
||||
void FORWARD_2_C(agent_set_max_neighbors, RID, p_agent, int, p_count, rid_to_rid, int_to_int);
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
/// time of the simulation. If the number is too
|
||||
/// low, the simulation will not be safe.
|
||||
/// Must be non-negative.
|
||||
virtual void agent_set_neighbor_dist(RID p_agent, real_t p_dist) const;
|
||||
virtual void agent_set_neighbor_distance(RID p_agent, real_t p_distance) const;
|
||||
|
||||
/// The maximum number of other agents this
|
||||
/// agent takes into account in the navigation.
|
||||
|
@ -79,7 +79,7 @@ void NavigationServer3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer3D::agent_create);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer3D::agent_set_map);
|
||||
ClassDB::bind_method(D_METHOD("agent_get_map", "agent"), &NavigationServer3D::agent_get_map);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &NavigationServer3D::agent_set_neighbor_dist);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_neighbor_distance", "agent", "distance"), &NavigationServer3D::agent_set_neighbor_distance);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer3D::agent_set_max_neighbors);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &NavigationServer3D::agent_set_time_horizon);
|
||||
ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer3D::agent_set_radius);
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
/// time of the simulation. If the number is too
|
||||
/// low, the simulation will not be safe.
|
||||
/// Must be non-negative.
|
||||
virtual void agent_set_neighbor_dist(RID p_agent, real_t p_dist) const = 0;
|
||||
virtual void agent_set_neighbor_distance(RID p_agent, real_t p_distance) const = 0;
|
||||
|
||||
/// The maximum number of other agents this
|
||||
/// agent takes into account in the navigation.
|
||||
|
Loading…
Reference in New Issue
Block a user