Allow NPCs to face targets while parented #387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request replaces the "local" origin/angle calls used for NPC facing and aiming with "absolute" origin/angle calls. This fixes issues with NPCs not being able to aim at or face targets while parented to an entity.
Normally, the "local" and "absolute" origin/angles of an entity are identical. They are only different when the entity is parented to another entity. When parented, the "local" origin/angles is relative to the parent, while the "absolute" origin is relative to the world as before. Most NPC calculations use the local origin and angles, presumably because local vectors are cheaper to calculate and NPCs are not normally parented. This causes issues in their navigation and facing code when a NPC is parented, but this PR will fix the latter.
Since the local and absolute origin/angles are identical when an entity is not parented, this also means these changes do not have any effect on NPCs which are not parented.
Does this PR close any issues?
PR Checklist
develop
branch OR targets another branch with a specific goal in mind