-
Notifications
You must be signed in to change notification settings - Fork 559
fix: Rogue dashing on pillars and out of bounds #543
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that bit is elevated. I'll likely end up modifying layer matrix then to properly fix this. |
if (Physics.RaycastNonAlloc(ray, k_CachedHit, k_MouseInputRaycastDistance, k_GroundLayerMask) > 0) | ||
|
||
// clear previous results | ||
for (int i = 0; i < k_CachedHit.Length; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this step? Why not just rely on the count returned by RaycastNonAlloc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the array always guaranteed to be populated orderly? I was wanting to access elements within the array, but that could simplify the iteration.
However, I'm revisiting this atm, so this may end up reworked. I think layers will be the cleanest fix (though it will affect prefabs and potentially some gameplay scripts).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the example here https://docs.unity3d.com/ScriptReference/Physics.RaycastNonAlloc.html
you want to use non-alloc for perf reasons, it wouldn't be super performant to have to access all elements to check if they are null :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's since been reworked and optimized.
24c0500
to
56df969
Compare
Placed on hold as this will target develop instead. |
Closing as this has been reworked to target |
Description (*)
This is a pathfinding solution that ties player navigation more rigidly with the navigation mesh generated.
A significant change here is the re-layering of Dungeon prefabs. A
Environment
layer has been introduced to distinguish between Ground vs Environment (non-interactive) level prefabs.Navigation is only successful when any "Ground"-tagged object is intersected via raycast, as well as when the intersection point is a valid point on the generated nav mesh. This eliminates any teleports to the tops of any ground colliders, since the point of interest will always be on the navmesh floor.
While testing, it was also discovered that the rogue could dash outside the level. If there was any part of the navmesh that bled outside the bounds of the level (very few cases), the dash could travel to that point.
To combat this, a minor tweak was added to
DynamicNavPath
which eliminates appending the last point to the nav path (since this point could actually be out of bounds).A last added bonus from this PR is that the rogue no longer goes through the door, since the visibility check inside
ActionUtils
now uses the Environment layer as a blocking layer (as well as for the mage shot).Related Pull Requests
This is work on top of PR 542
Issue Number(s) (*)
Fixes issue(s): MTT-2412
Manual testing scenarios
Questions or comments
I'm thinking this might not be a workaround. I think it does make sense for navigation to be directly linked to the nav mesh.
Another comment here is that
ClientInputSender
is beginning to become too much of a god class. This needs to be broken down to only process input and publish results to listeners.Contribution checklist