Skip to content

Conversation

@vulture-boy
Copy link
Contributor

@vulture-boy vulture-boy commented May 2, 2022

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.

adAxis = data.adAxis;
wsAxis = data.wsAxis;

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

Choose a reason for hiding this comment

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

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
Copy link
Member

dmarcos commented May 3, 2022

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

@vulture-boy
Copy link
Contributor Author

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

@vulture-boy
Copy link
Contributor Author

Your approach is implemented! ✔️

@vulture-boy vulture-boy requested a review from dmarcos May 3, 2022 15:35
@dmarcos
Copy link
Member

dmarcos commented May 5, 2022

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

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