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

Add actor.oldGlobalPos, deprecate getGlobalPos in favour of globalPos getter #3017

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

mattjennings
Copy link
Contributor

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

Closes #2922

Changes:

  • actor.oldGlobalPos returns the globalPosition from the previous frame
  • actor.getGlobalPos() - use actor.globalPos instead
  • actor.getGlobalRotation() - use actor.globalRotation instead
  • actor.getGlobalScale() - use actor.globalScale instead

This required some changes to MotionSystem so that globalPos could be properly captured. Previously, the parent's transform may have already been updated in the system's update when processing a child entity, leading to an incorrect oldGlobalPos value. Now, the MotionSystem update captures the entity & all of its children at the same time, skipping any entities that have parents as to not capture them twice over.

This also deprecates other getGlobalXYZ() functions and replaces them with getters for consistency.

deprecate getGlobalRotation for globalRotation getter
@github-actions github-actions bot added the enhancement Label applied to enhancements or improvements to existing features label Apr 7, 2024
Copy link

cloudflare-workers-and-pages bot commented Apr 8, 2024

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7c9b74c
Status: ✅  Deploy successful!
Preview URL: https://1eb37e43.excaliburjs.pages.dev
Branch Preview URL: https://feat-2922.excaliburjs.pages.dev

View logs

@eonarheim eonarheim merged commit 76bf8d6 into main Apr 25, 2024
7 of 8 checks passed
@eonarheim eonarheim deleted the feat/2922 branch April 25, 2024 13:46
@eonarheim
Copy link
Member

@mattjennings Sorry it took me so long to merge this! Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Label applied to enhancements or improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add getGlobalOldPos() helper to Actors
2 participants