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

InputManager: Fix Picking on PointerUp and add bool to skip pointerup picking #12524

Merged
merged 9 commits into from May 27, 2022
Merged

InputManager: Fix Picking on PointerUp and add bool to skip pointerup picking #12524

merged 9 commits into from May 27, 2022

Conversation

PolygonalSun
Copy link
Contributor

@PolygonalSun PolygonalSun commented May 13, 2022

Recently on the forums (forum post), there was a user who found an issue with the pointerUpPredicate not being used by the InputManager properly. When a dummy predicate was used (() => false), there was still a pickedmesh/point in the pickInfo object. This PR does a couple of things:

  • Fix for the picking logic to use the pointerUpPredicate and actually call scene.pick
  • Add a boolean to scene that allows the user to skip picking on pointerup (same as move and down)

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

Just a small question, otherwise LGTM!

packages/dev/core/src/Inputs/scene.inputManager.ts Outdated Show resolved Hide resolved
@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@sebavan sebavan marked this pull request as draft May 16, 2022 20:12
@PolygonalSun PolygonalSun marked this pull request as ready for review May 18, 2022 23:37
@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@PolygonalSun PolygonalSun marked this pull request as draft May 19, 2022 00:28
@PolygonalSun PolygonalSun marked this pull request as ready for review May 19, 2022 00:45
@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

Copy link
Contributor

@nekochanoide nekochanoide left a comment

Choose a reason for hiding this comment

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

Seems like pick is still occuring
Though, I tested (I believe) this commit and it worked
Test pg:
https://playground.babylonjs.com/?snapshot=refs/pull/12524/merge#CASE7T#3

@sebavan
Copy link
Member

sebavan commented May 19, 2022

@PolygonalSun could you double check ? I can repro the picking being set on pointer up

@PolygonalSun
Copy link
Contributor Author

Seems like pick is still occuring Though, I tested (I believe) this commit and it worked Test pg: https://playground.babylonjs.com/?snapshot=refs/pull/12524/merge#CASE7T#3

Okay, so this pick isn't directly apart of the picking done by up, down, or move but is triggered as part of _initActionManager function that would pick a mesh and return an action manager for said mesh (if applicable). I'm hesitant to change a lot of the logic here so what I'm going to do is to add an if statement to check if all three skip bools are true and if so, it will skip the pick entirely.

@sebavan
Copy link
Member

sebavan commented May 19, 2022

This is a different issue than the one you were addressing in here. I would suggest to make it another PR. I do not think the flag combination is the right approach for it. This would probably need a separate way to turn it off ? @deltakosh what do you think ?

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@PolygonalSun PolygonalSun marked this pull request as draft May 20, 2022 22:23
@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@PolygonalSun PolygonalSun mentioned this pull request May 23, 2022
4 tasks
@PolygonalSun
Copy link
Contributor Author

Current findings: All of the skips disable picking as they should and the pointerUpPredicate is now being used properly in _initActionManager.

One thing that I've noticed is that the code for onPrePointerObservable gets notifyObservers called after the pick has happened (for pointerup only) so changes to pointerUpPredicate won't be used if set in an observer for onPrePointerObservable. Since there is a specific logic for when this is used, I'm not sure if I should change it. What do you think @sebavan? If we don't need to change it then the PR should have everything it needs.

@PolygonalSun PolygonalSun marked this pull request as ready for review May 27, 2022 00:16
@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@deltakosh deltakosh merged commit 87d7c0f into BabylonJS:master May 27, 2022
alvov-evo pushed a commit to alvov-evo/Babylon.js that referenced this pull request Jun 16, 2022
… picking (BabylonJS#12524)

* Add bool to skip picking on up and fix pointerup picking

* Remove left over comment

* Update skipPointerUpPicking to be true by default

* Changed skipped pointerup picking info to just be _currentPickResult

* Re-added !pickResult

* feedback

* Add additional check for picking to _initActionManager

* feedback

* Re-added missing line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants