First Person Interaction For Flash Please!

Update: This feature has now been added to flash 11.2. you can read more about it here: http://www.bytearray.org/?p=3755
———————————————————————————————————-
———————————————————————————————————-

While creating 3d environments within flash you are currently limited in the way you get user mouse input. In your traditional first person shooters moving the mouse will turn the view left and right, up and down. The problem you face within flash is that once the mouse hits the edge of the movie or if it is in full-screen mode, the side of the screen there is no way to receive mouse input as the mouseX and mouseY values to longer change, even if the user is still moving the mouse.

The first two videos below show methods which are achievable with the current functionality, the last video shows what would be possible if we had access to raw mouseOffset values.

Get Adobe Flash player


AbsoluteDrag shows the view turning via the absolute location of the mouse. The problem with this method is that as soon as the cursor hits the side of the flash movie input stops.

Get Adobe Flash player


AbsoluteClickAndDrag only turns the view when the user clicks and drags the mouse. This method continues to turn the view after the cursor has left the stage as long as the mouse button remains held down, however stops as soon as the cursor hits the side of the screen, it’s also not ideal for the user to always have to click and drag to turn as you would usually use the left mouse button as an action input (eg fire your gun).

Get Adobe Flash player


RelativeDrag is my suggestion to this problem. With this extra functionality you could turn the view based on the raw mouse offset values, this way it doesn’t matter if the mouse is outside the flash movie or is even hard up against the side of the screen, the view will continue to turn. In the above example video this was achieved by opening a socket to a small c based program which broadcasts the mouse x and y offsets, however obviously you don’t want the user to have to download an extra program every time you use this kind of interaction.

Possible solutions:
1. Two new mouse properties: mouseOffsetX and mosueOffsetY, which would give you the displacement of the raw mouse data in the X and Y. These properties would output the raw offsets regardless of if the mouse was against one side of the screen or outside the stage.
2. Another option would be to make the mouseX and mouseY properties read/write. I realize there are potential security issues surrounding this approach as I am sure malicious sites would steal the users cursor, however if this was only available in full-screen mode or the user was prompted with a message similar to the microphone access message this approach could work.

The flash player team must be extremely busy with other issues, however this would be a really helpful addition to the player that would really open up the possibilities for 3d gaming environments.

If you think this added functionality a good idea and would like to support the request please visit the below url and cast your vote.

http://bugs.adobe.com/jira/browse/FP-4523

Cheers

16 Comments

  1. What do you mean under additional Mouse input data?

  2. This is explained in my post, but basically raw offset mouse values which update regardless of if the mouse is inside or outside the stage. The offsets would also have to be links to the actual raw mouse x and y offsets rather than just cursor offset. As this topic isn’t a direct linked to away3d I would suggest posting future questions to my post. Support for this request would be much appreciated.

  3. That is funny feature, Why would someone need it really ?

  4. I think it is a great feature request and have voted for it.

    To answer Michael & Moley; Someone would need it if they wanted to create a traditional first person control scheme, which does not mean clicking and dragging to rotate the view (as was already covered in Pete’s feature request description.) I actually touched briefly upon this very limitation in the book, and I think it’s a perfectly valid feature request.

    Cheers
    /R

  5. I think a more general request for a lower-level mouse input API would be fitting :-)
    It doesn’t involve setting the mouseX and mouseY writable (which honestly would make little sense) but offer another entry point to listen to mouse events (ie: not the display list) and all it’d say is: “The mouse device moved [not necessarily the cursor], and here’s your deltas”.

  6. Yeah , like in Unity3D :)

  7. This is the way the mouse worked in Shockwave, and it still probably does,
    so it’s weird it wouldn’t (can’t?) work the same way in Flash. That feature
    alone has stopped me a couple time from making a Quake killer in Flash :)

    -Pete Kapelyan

  8. Many useful things can’t work in Flash :(

  9. Hi David
    I’d be happy with whatever approach adobe could up with as long as it solves the issue discussed above.

    Your right, set mouseX/Y probably isn’t the way to go, but the idea behind it goes something like this.
    If your in fullscreen mode:
    You set Mouse.hide()
    Set mouseX and mouseY to the center of the stage
    When the mouse moves you get the offset from the center, update the
    scene
    Reset mouseX and mouseY to the center of then stage
    and repeat

    I can see Adobe only allowing this functionally in full-screen mode for security reasons. I’m sure this approve would work, but yeah there are better solutions.
    Lower-level mouse input API would be great!

  10. What a game! Flashback from my youth :)

  11. “This is exactly what you’d be able to achieve with this feature”

    I tried this game in chrome and it works but you have no mouse pointer to see how to click on the browsers close button or switch tabs etc once you’re done playing?

  12. I totally agree… the lack of low-level mouse data is crippling. At the very least a mouseDeltaX and mouseDeltaY would help, but with the new input devices such as the Magic Mouse, more info will be almost mandatory for developers.

    Has anyone found a way around this??

    The JS solution is not viable… consider the mouse being stuck in the upper-left corner of the screen, but the user keeps moving the mouse. You will get a stream of 0,0 events, and have no way of determining if the mouse is being moved left, up, or diagonally, only that the mouse IS moving.

  13. Could you possibly make your c mouse coordinate reporting program available?

  14. Yeah completely, However one of the reason flash is such a great platform is because of its high penetration rate, so making the user download an additional program to view your content isn’t really an option. Anyway hopefully this will be fixed in an upcoming release, the last comment on the bugs.adobe.com posted by someone of adobe is very encouraging.

    “Yes, this is an issue we know and we take it seriously. We have plans for this, and we are working on it.”

Submit a Comment

Your email address will not be published. Required fields are marked *