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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.