Leap Motion SwipeGesture - gesture

I am looking into the leap motion controller. I want to integrate the leap motion controller into my app for the sole reason of gestures -- up, down, left, right.
Will SwipeGesture be the correct method to use? Do people have trouble using it? (i.e., does it work only half the time?)

Swipe gestures are pretty robust. You can set parameters for minimum speed and length before a swipe gesture will be recognized to fine tune things for your app (except in JavaScript, where this isn't supported).
The Swipe gesture is probably the easiest way, but you could also do your own recognition using the hand and finger positions also provided by the API.

Related

Swap Gestures in HERE sdk

I'm trying to remove the default pan behaviour, which is easily done with:
mapView.getGestures().disableDefaultAction(GestureType.PAN);
and use the TWO_FINGER_PAN gesture instead, but I can't quite find a solution for this other than coding the entire animation by myself. Is there an easier way? Maybe some source code I couldn't find?
To summarize I want the TWO_FINGER_PAN gesture to do the exact same thing the PAN gesture would do.
When you disable a gesture, you have to handle the gesture on your side. There is no source code exposed for this as part of the HERE SDK. But you may want to look for native Android gesture handling examples.
The Gestures example app that is shipped with the HERE SDK provides as least a starting point for custom gesture animations with the GestureAnimator class, but for a pan gesture you would usually not need any animation, so a finger movement relates to a change of the target coordinates of the MapView.
Please confirm the the Here SDK version that you looking for? To explain more about the reason this function is not available because, the pan gesture is designed for single finger including kinetic panning. Two finger pan behaves different. So the best user experience is still with normal panning.
Also two finger gestures are also used for tilting and rotating map. To achieve panning with two fingers can be confusing for users.
Detail information about default behaviour in 4.x in explained in the below link:
https://developer.here.com/documentation/android-sdk-navigate/4.7.6.0/dev_guide/topics/gestures.html

replace WASD keys navigation with VR tracked controllers a-frame

I've developed an a-frame scene in a different location to where I will be able to use a headset (either oculus or HTC).
Is the tracked controller functionality built into aframe 0.7.0?
Is there code I need to add to detect these controllers and replace the desktop WASD navigation with the tracked controllers? I don't need any hands to be visible I just need to achieve the up/down/left/right movement in space.
Thanks
Don McCurdy's aframe-extras includes a component called universal-controls that I highly recommend. Specifically there is a gamepad-controls component that may do exactly what you're looking for right out of the box.
If not, universal-controls supports extending the main component with "custom" controllers. The ability to do so is lightly documented on the repository page, but it's pretty straightforward. I'm working on one for the GearVR controller that responds to pressing the GearVR trackpad to achieve movement. I still need to work on getting backward movement, but you can find my work so far at Github.
Once you've developed your own custom controller, (or decided to use mine, or whatever), you attach it to your scene's camera, like this:
<a-entity
id='scene-camera'
camera="userHeight: 1.6"
position='24 1.6 14'
universal-controls='movementControls: universal-gear-vr, keyboard;'
universal-gearvr-controls>
Things to note from above: Rather than the default setting, (which will attempt to load all movement controls schemes that are available), I'm telling the universal-controls component to use my custom component, by giving it's name in the movementControls parameter. Notice that I leave off 'controls' from the name though. That's because universal-controls adds that back later. With that said, I also attach my custom component to the camera, which must be done so that universal-controls can find and use it.
A quick note though, on enabling backward movement, if that's something you're interested in. I've already done it by hacking around with the original WASD movement script. You can take a look at what I did if you'd like to see that.

How can i make avatar hands with Leapmotion

I download and import 'Avatar Hand controller' with Leapmotion. And, I want using that source to make my own avatar hand controller. So, I download any avatar models and insert same script of 'Avatar Hand controller' into my avatar hands and fingers. But, hands of the downloaded avatar works well, my avatar doesn't work like this picture. The hand itself recognized, but arm stretches like a monster.
How can I solve this? please help me.enter image description here
If you are using a commercial Unity asset, you should ask for support from that developer.
The crux of the problem is that you (or the scripts involved) are applying translation to the hands, which causes this sort of stretching. You often only want to apply rotations from the Leap Motion data, not translation, but it really depends on how you are animating the avatar. For example, you could implement an IK solution to move the avatar's elbows to the Leap Motion elbow position and then use rotations from there -- or you could use IK to set the hand position and not use the Leap arm data at all. It is a fairly involved task.
There is some work to that end here, but I don't know how finished it is.

pointerHover is not being called?

In the eclipse simulator environment, I don't seem to be receiving any
pointerHover calls on my components. Is there something I need to do
to arm them?
[edit/response]
No one will find it acceptable to deliver desktop applications that don't support mouse movement input.
Likewise, there are many new input devices on the horizon which will require specialized support, but will all expect mouse simulation to be the baseline. For example gesture capture by Kinect, leap motion or VR headsets will need to feed standard events to applications that have not been specifically rewritten to use them.
We don't support those events since there is no pointer hover on the device. We might support it in a future case for desktop builds but even then the simulator will not send those events.
We might support this for the new Apple 3d touch API although I think this might be too simplistic.
This API was originally introduced for the blackberry 5 device which had a "click screen" that allowed hovering and clicking.
You should use pointerDrag events which are more representative of all devices.

How can I get a smooth text crawl using Flex?

I'm working on a standalone Flash application (written using Flex 3/ActionScript 3) that features a text crawl, like what you might see at the bottom of your TV when watching a cable news channel; it's a long narrow box that text moves across from right to left.
I've implemented it by creating a Label element, populating it with text, and then moving it using a mx:Move object with a Linear.easeNone easing function. It works, but it has ample room for improvement. It looks a bit jerky, and tends to have a fair amount of "tearing" (the top and bottom halves of the text sometimes fall out of sync).
I tried throwing math at the problem to get the crawl's movement rate synced with the monitor's refresh rate, but that was a bust. I found out the hard way that the app's frame rate jumps around too much; the "optimized" crawl varied between looking silky smooth and like it had epilepsy.
Is there anything else folks would recommend I try to smooth this thing out? Is there some alternate design you'd recommend I try?
Edit: Some context: the crawl is part of a digital signage application (played from a standalone Flash projector -- no web browser) that does stuff elsewhere on the screen, including video playback and rendering text and images. It definitely gets choppier during video playback, but it's never as smooth as I'd like it to be.
There are two potential solutions to this problem, but both have caveats, the first because of your use of Flex and a standalone projector, the second because it is a mitigator, not a complete solution.
Hardware Acceleration
When publishing your file, you can attempt to have Flash utilize hardware acceleration to alleviate the vertical refresh issue you are running into that is causing tearing. Sadly, Flex Builder 3 is incapable of enabling this setting at the SWF (projector) level (Link to bug). This has yet to be resolved and has been pushed from 4.0 to 4.1 to 4.x... If and when it is resolved, it will likely be a compiler argument in the project settings of Flash Builder 4.
You may be able to determine if this solution works for you by outputting your projector as a standard SWF and embedding it on an HTML document with the wmode set to "direct" or "gpu". Sadly, if it does (it should), you can't use it right now anyway. If you have Flash Builder 4, certain projects are capable of making round trips between FB4 and Flash Professional CS5, though I am not sure what the criteria for that is (my current AIR project has all the project modification menu options grayed out). If you do manage to get your project into Flash, you can enable hardware acceleration in the Publish Settings of the project (File->Publish Settings->Flash tab->Hardware Acceleration option in CS5).
This method is almost a certain solution for your problem, though it has two issues, one already highlighted above, and (for people publishing for the web) that by utilizing direct or GPU rendering on a webpage, you are unable to layer any DOM elements on top of flash.
direct: This mode tries to use the fastest path to screen, or direct path if you will. In most cases it will ignore whatever the browser would want to do to have things like overlapping HTML menus or such work. A typical use case for this mode is video playback. On Windows this mode is using DirectDraw or Direct3D on Vista, on OSX and Linux we are using OpenGL. Fidelity should not be affected when you use this mode.
gpu: This is fully fledged compositing (+some extras) using some functionality of the graphics card. Think of it being similar to what OSX and Vista do for their desktop managers, the content of windows (in flash language that means movie clips) is still rendered using software, but the result is composited using hardware. When possible we also scale video natively in the card. More and more parts of our software rasterizer might move to the GPU over the next few Flash Player versions, this is just a start. On Windows this mode uses Direct3D, on OSX and Linux we are using OpenGL.
**Source*
Direct is the ideal option for this situation, as you can actually have performance degredation with "gpu" as well as visual differences from graphics card to graphics card.
Lower your framerate
The Flash player will continue to play video at its native refresh rate independent of the rest of your project as long as you keep the framerate at or above approximately 2FPS (though I suggest 5FPS minimum). You won't want to run that low for this example, but you are able to lower the framerate of the entire scene without impacting video performance. The closer your framerate is to the screen refresh rate, the more apt you are to actually create the tearing effect unless you are able to absolutely sync with the monitor's refresh rate, which you probably cannot do without the above... Hardware Acceleration.
This problem has existed in the Flash Player for as long as it has been able to move objects horizontally. What happens is that Flash updates a buffered snapshot of the running animation at the same time that the screen is refreshing. If the buffered snapshot changes partway through a screen refresh, you get a tear. This is why lowering the framerate actually reduces the amount of tearing, you are refreshing the buffer less frequently.
As #Tegeril mentioned, using Flex is one of the reasons. Flex is a pretty heavy framework and it does a lot of things behind the scenes. If you're familiar with the life cycle of a component(especially invalidating properties, invalidating the display list, etc.).
As a few minor things that might improve performance:
try to keep a simple display list. If you know the app will always be displayed at one size, then flex won't waste time traversing the display list/tree up to the top and back for measurements. Also, try to use a Canvas. I know, it's not very clean, but since it uses absolute values and doesn't check with the 'parents' much, it should be faster than other containers(like HBox,VBox, etc.)
try to display the video at it's full size(make sure the encoded video dimensions are right so there be any CPU cycles on resizing video
Ok, this was Flex stuff.
It might be very handy to read sencular's article on Asynchronous ActionScript Execution which explains how Flash Player handles updates and renders.
(source: senocular.com)
Frames both execute ActionScript and render the screen
(source: senocular.com)
ActionScript taking a long time to complete delays rendering
I imagine the jerkiness is related to this. Also, I'm guessing you might
get moments of smooth movement then sudden halts, every now and then, when
Flash Player catches it's breath(Garbage Collector cleans up)
Victor Drâmbă article on “Multithreading” in Actionscript might also
be useful.
Soo, to recap:
use Profiler or something and see if the Flex framework is slowing you down, or where the 'bottleneck' is
improve as much as you can on that side then check if it's how Flash Player handles all the actionscript('elastic' frames)
If the bottleneck comes from the Flex framework, worst case, you
can try to minimise the number of components that traverse the display list,
and use pure actionscript for the other things(as #PatrickS suggested, use TweenLite, etc.)
If it helps, try to preload data(fetch rss feed and all that) at the start, and when you've got most of the important bits that don't require 'refreshes'/loads frequently, display the app. You will use more memory, but will have more cpu cycles to spare for other tasks.
Also, if it's display objects that are the 'bottleneck' and there's plenty of them, check if you can reuse them using Object Pools.
HTH
TweenMax or even TweenLite ( http://www.greensock.com )handles this sort of job pretty well. What else is your app doing while the text is scrolling though? Is it possible that some other processes are interfering?
This may not be helpful, but have you considered putting the crawling text into the html DOM and using CSS transitions to crawl the text. Obviously there's the IE problem, but it should be supported in IE9 and you could use javascript as a fallback.
This may seem silly, but CSS transitions are getting hardware acceleration and separate processes for plugins meaning on a multicore machine you could get parallel threads.
One thing you might consider is to move your label incrementally using a Timer instead of an easing function. That way you can take advantage of the updateAfterEvent method to get smoother rendering. Here's a link to an article/video from Chet Haase (Adobe's Flex graphics dude) that explains usage along with an example app with code:
http://graphics-geek.blogspot.com/2010/04/video-event-performance-in-flex.html
Hope that helps.

Resources