Centralize Player Aim Direction Calculation - #159
Open
Anand-Ramnarain-27 wants to merge 1 commit into
Open
Conversation
Replace duplicated camera- and look-axis-based aim calculations in AbilityBase and PlayerTargetController with a single call to Input::getAimDirection(ownerPosition, playerIndex[, deadzoneSq]). Both methods now fetch the owner's Transform and return Vector3::Zero if it's missing. Removes fallback camera/axis normalization and duplicated logic, centralizing aim computation and passing the deadzone from AbilityBase.
AndreuMiroSabate
approved these changes
Aug 25, 2026
AndreuMiroSabate
left a comment
Contributor
There was a problem hiding this comment.
It works as expected and I think avoiding this calculations would help with the optimization of the game.
Also testing the aim, I noticed that the aiming of the gamepad can be improved a little bit, because now it feels awkward selecting a target, like you need to aim directly to it. For me maybe we could change the system so when changing the target with the gamepad it selects the aimable object nearest to the direction aimed. But this is a thought that we will need to test more.
For the rest good job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Simplified the aim direction calculation by using
Input::getAimDirection()in bothAbilityBaseandPlayerTargetController.Transformand use the same centralized aim calculation.Vector3::Zeroif the owner'sTransformis missing.AbilityBasenow passes the deadzone value toInput::getAimDirection().Test Plan
AbilityBaseand confirm they aim correctly.Transformis missing.