double rand = Assets().random.UNorm();
if (fert > rand) {
std::cout << "[" << int(GetCreature().GetSimulation().Time())
- << "s] splitting " << GetCreature().Name()
- << " because " << fert << " > " << rand << std::endl;
+ << "s] " << GetCreature().Name() << " split" << std::endl;
Split(GetCreature());
}
}
} else {
double dist = glm::length2(GetSituation().Position() - target_pos);
if (dist < 0.0001) {
- GetSteering().Halt();
- searching = false;
+ LocateResource();
} else {
GetSteering().GoTo(target_pos);
}
target_pos = GetSituation().Position();
target_pos[(srf + 0) % 3] += Assets().random.SNorm();
target_pos[(srf + 1) % 3] += Assets().random.SNorm();
+ // bias towards current direction
+ target_pos += glm::normalize(GetSituation().Velocity()) * 0.5;
GetSteering().GoTo(target_pos);
}
}