mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +01:00
Fix GSAIAvoidCollisions;s logic.
This commit is contained in:
parent
67368542ad
commit
642a590949
@ -22,6 +22,7 @@ void GSAIAvoidCollisions::_calculate_steering(Ref<GSAITargetAcceleration> accele
|
||||
|
||||
if (neighbor_count == 0 || !_first_neighbor.is_valid()) {
|
||||
acceleration->set_zero();
|
||||
linear = Vector3();
|
||||
} else {
|
||||
if ((_first_minimum_separation <= 0 || _first_distance < agent->get_bounding_radius() + _first_neighbor->get_bounding_radius())) {
|
||||
linear = _first_neighbor->get_position() - agent->get_position();
|
||||
|
@ -37,8 +37,7 @@ void GSAIPriority::_calculate_steering(Ref<GSAITargetAcceleration> accel) {
|
||||
int size = _behaviors.size();
|
||||
|
||||
if (size > 0) {
|
||||
for (int i = 0; i < size; ++i) { //i in range(size)
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
Ref<GSAISteeringBehavior> behavior = _behaviors[i];
|
||||
|
||||
ERR_CONTINUE(!behavior.is_valid());
|
||||
@ -58,7 +57,7 @@ void GSAIPriority::_calculate_steering(Ref<GSAITargetAcceleration> accel) {
|
||||
|
||||
GSAIPriority::GSAIPriority() {
|
||||
zero_threshold = 0.0;
|
||||
_last_selected_index = 0;
|
||||
_last_selected_index = -1;
|
||||
}
|
||||
|
||||
GSAIPriority::~GSAIPriority() {
|
||||
|
Loading…
Reference in New Issue
Block a user