Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow NPCs to face targets while parented #387

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Blixibon
Copy link
Member

@Blixibon Blixibon commented Feb 9, 2025

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

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant