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

Pathfinding patch #829

Closed
wants to merge 5 commits into from
Closed

Pathfinding patch #829

wants to merge 5 commits into from

Conversation

metricrb
Copy link

Changes

When we call Humanoid:MoveTo() from waypoint to waypoint, and use the MoveToFinished event to detect when the character reaches each waypoint it does work. However unlike the demo place and code portrayed in the documentation on Character Pathfinding, many games will not operate with smoothness due to the event having a delay on being communicated, leaving a stuttering NPC between nodes and overall a poor visual effect.

This is detrimental on considering performance in public games, unlike test baseplates with minimal events and memory.

To resolve this issue, I implemented a snippet of ClickToMoveController under Player > PlayerScripts > PlayerModule > ControlModule.

You should notice that ClickToMove controller does not register for MoveToFinished but instead uses its own logic to decide when to move to next waypoint - namely the RunService.RenderStepped event. This would avoid waiting for the delayed event.

https://devforum.roblox.com/t/npc-moveto-has-a-stuttering-effect-whilst-using-pathfindingservice/3067241?u=m_etrics

Checks

By submitting your pull request for review, you agree to the following:

  • This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses.
  • I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses.
  • To the best of my knowledge, all proposed changes are accurate.

@metricrb metricrb requested a review from a team as a code owner September 17, 2024 13:44
@github-actions github-actions bot added the engine guides Changes the Engine guides label Sep 17, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @metricrb, thanks so much for helping improve the Roblox creator documentation! Our technical writing team will review your pull request soon. In the meantime, please ensure you've read through the README.md, contribution guidelines, and style recommendations.

@IgnisRBX
Copy link
Contributor

Hi @metricrb , this looks like a great change, but I tested it briefly and my character stopped at the first waypoint (did not continue onward). Could you please check how it works for you, or point out what may be happening in my test?

@metricrb
Copy link
Author

Hi, @IgnisRBX, you are completely right. It seems that the example code I submitted had a small mistake caused by me when I was copying it out of my game systems to function as an example. Please try again with the most recent commit. Apologies for any inconvenience.

@IgnisRBX
Copy link
Contributor

Hi again @metricrb ,
I tested your updated code and it seems now that the character is attempting to move toward the final waypoint in the path, not the next one in the series of waypoints. Are you seeing the same behavior?

@metricrb metricrb marked this pull request as draft September 21, 2024 11:51
Copy link

github-actions bot commented Oct 5, 2024

This pull request has been inactive for 14 days. If it remains inactive for another 7 days, it will close. Please update or comment on this pull request to keep it open. 🙏

@github-actions github-actions bot added the stale label Oct 5, 2024
Copy link

This pull request has been inactive for 21 days. It's closing now. Please feel free to reopen it if you still need it. 🙏

@github-actions github-actions bot closed this Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine guides Changes the Engine guides stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants