fix: player detector checks normalized dot product
This commit is contained in:
parent
0b656459dc
commit
55f254d4ec
2 changed files with 2 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ bool PlayerDetector::check() const {
|
|||
Vector3 const position{ get_global_position() };
|
||||
Vector3 const target{ PlayerBody::get_singleton()->get_global_position() + Vector3{ 0.f, 1.5f, 0.f } };
|
||||
// check if the target is in a view cone
|
||||
if (forward.dot(target - position) < this->min_sight_dot) {
|
||||
if (forward.dot((target - position).normalized()) < this->min_sight_dot) {
|
||||
return false;
|
||||
}
|
||||
// check if the target is in range
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue