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 InputManager #394

Closed
yangfengzzz opened this issue Jul 16, 2021 · 1 comment · Fixed by #497 or #524
Closed

Add InputManager #394

yangfengzzz opened this issue Jul 16, 2021 · 1 comment · Fixed by #497 or #524
Assignees
Labels
enhancement New feature or request high priority High priority issue
Milestone

Comments

@yangfengzzz
Copy link
Member

yangfengzzz commented Jul 16, 2021

Refactor existing physical event logics from the collider and raycast. Redesign the APIs, which will be consistent with PhysX in the future.

PR reviewers:@GuoLei1990, @singlecoder, @gz65555 , @zhuxudong

@yangfengzzz yangfengzzz added enhancement New feature or request high priority High priority issue labels Jul 16, 2021
@yangfengzzz yangfengzzz added this to the 0.5 milestone Jul 16, 2021
@GuoLei1990 GuoLei1990 changed the title Physical event in script without PhysX Mouse event in script without PhysX Jul 16, 2021
@GuoLei1990
Copy link
Member

GuoLei1990 commented Jul 16, 2021

Whether to unify single-point Touch and Mouse events needs to be discussed. From the point of view of ease of use for developers, I think we need to unify
Before we only consider mouse, but now we should consider mobile device(touch). So the call back named onMouseXX() is not good, I thnk use onPointerXX() instead onMouseXX() or onTouchXX() is better for modern design.

class Script
{
  /**
     * Called when the pointer is down while over the Collider.
     */
    onPointerDown(): void {}
  
    /**
     * Called when the pointer is up while over the Collider.
     */
    onPointerUp(): void {}

    /**
     * Called when the pointer is down and up with the same collider.
     */
    onPointerClick(): void {}
  
    /**
     * Called when the pointer is enters the Collider.
     */
    onPointerEnter(): void {}
  
    /**
     * Called when the pointer is no longer over the Collider.
     */
    onPointerExit(): void {}

    /**
     * Called when the pointer is down while over the Collider and is still holding down.
     * @remarks onMouseDrag is called every frame while the pointer is down.
     */
    onPointerDrag(): void {}
}

@GuoLei1990 GuoLei1990 modified the milestones: 0.5, 0.6 Aug 4, 2021
@GuoLei1990 GuoLei1990 changed the title Mouse event in script without PhysX Add InputManager Sep 6, 2021
@cptbtptpbcptdtptp cptbtptpbcptdtptp linked a pull request Sep 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority High priority issue
Projects
None yet
3 participants