FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clear velocity on previous WS / AD axis when changed to a new value by vulture-boy · Pull Request #5050 · aframevr/aframe · GitHub

Clear velocity on previous WS / AD axis when changed to a new value - #5050

Merged
dmarcos merged 4 commits into
aframevr:masterfrom
vulture-boy:wasd-new
May 5, 2022
Merged

Clear velocity on previous WS / AD axis when changed to a new value#5050
dmarcos merged 4 commits into
aframevr:masterfrom
vulture-boy:wasd-new

Conversation

vulture-boy commented May 2, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

In 1.3.0, if the WS or AD axes is changed during runtime, the old velocity associated with the last axis 'sticks' to the entity, resulting in often unwanted, constant movement. This change clears that velocity when the WS or AD axes are adjusted to a new value.

The script now monitors if the WS or AD axis is dynamically changed (via previous value variable) and clears the velocity value associated with its previous axis when a change occurs during an update. The nature of this stop is not smoothed, however... leaving that resolution to the future.

Comment thread src/components/wasd-controls.js Outdated
adAxis = data.adAxis;
wsAxis = data.wsAxis;

// If a control axis was changed, reset its old velocity

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This would be better handled in an update method by checking the oldData parameter:

  if (oldData.adAxis !== this.data.adAxis) { velocity[oldData.adAxis] = 0; }

dmarcos commented May 3, 2022

Copy link
Copy Markdown
Member

Thanks so much for submitting. I suggested a slightly different approach.

Copy link
Copy Markdown
Contributor Author

Makes sense! Didn't realize there was an 'oldData' that could be accessed haha.

Copy link
Copy Markdown
Contributor Author

Your approach is implemented! ✔️

vulture-boy requested a review from dmarcos May 3, 2022 15:35

dmarcos commented May 5, 2022

Copy link
Copy Markdown
Member

Thanks. Just edited to reformat and reword comment. Congrats on your first contribution 🎖️

dmarcos merged commit 480a303 into aframevr:master May 5, 2022
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL