Vega workshop

how to manage multitouch with Pixi 4.0.1

Recommended Posts

Hello :)

I am using Haxe with pixi v4, previously v3 (3.1.2).

We can catch a pixi.interaction.EventTarget from a registered touch event listener.

In the previous version, we could identify the touch thanks to the EventTarget::data.identifier property (member of InteractionData).

The identifier property doesn't exist anymore with v4, does it ? Is there an alternative mechanism to distinguish a touch event from another ? (ie player 1, player 2, ...)

I believe I could handle the problem, managing a collection of registered "touchdown" event. If a "touchmove" occures, I can associate it to the nearest registered position. If a "touchup" occures, I can remove the nearest registered position (this is theoric, I now there would be some cases to solve, ie a position disappears without a "touchup")

But, no need to code this if there is a technic, a pattern to use to manage multitouch ... any idea ? thx :)

Share this post


Link to post
Share on other sites

Nice to track this one :)

For the moment, I associate a "touchmove" event to the nearest previous "touchdown" I registered. Most of the time, it seems to work fine but there is some issues when the different touches get too close to each other.

There's also another issue with iOS, when you get to close to the edge of the screen, which triggers an iOS popup that messes the touch events. In v3, thanks to the "identifier" property I could detect the issue because the "identifier" changed. In v4, without "identifier", I use a timeout which clears a registered touch if no input is detected. It works :) ... I know I should be looking for some kind of "deactivate" event, another story ... :)

Thanks for the work on pixi ! :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.