Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Daniel G · Oct 01, 2013 at 10:11 PM · c#

Unity and Leap Motion: Help with Jerkiness of input!

Hello, I just want to use some math equation that helps take out the input jitter from my Leap Motion Controller. Leap Motion Heres the Code:

         //Cameras look at angle, up or Down
         if (HandOpen(leftHand)) {
             camRotateVertically = leftHand.PalmNormal.Pitch;
             //Debug.Log (((-camRotateVertically) - 1.5f) * 80.0f);
             CameraControl.yAngl = ((-camRotateVertically) - 1.5f) * 80.0f;
         }


Unfortunately I am getting some slightly random input when i dont move my hand at all (very minimal BUT its directly controlling the camera, which makes it obvious), i need the camera movement to be very responsive as well, so its just a matter of finding averages? Something along those lines

Thanks for the Help! Daniel

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Daniel G · Oct 01, 2013 at 10:13 PM 0
Share

This is C# BTW Just for the record i would like suggestions in C# too thanks!

avatar image Fattie · Oct 09, 2013 at 11:34 AM 0
Share

Just FTR here's the likely replacement technology for LEAP ...

http://www.kurzweilai.net/carnegie-mellon-disney-motion-tracking-technology-is-extremely-precise-and-inexpensive-with-$$anonymous$$imal-lag

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by MartinCA · Oct 01, 2013 at 11:16 PM

Feel free to look at any of the following:

Article 1

Article 2

Wikipedia: Averaging

Wikipedia: Smoothing

To sum it up briefly:

  1. Average will help you eliminate some of the noise, but will add latency. You'll want to find the sweet spot for your back buffer length to get the best results in terms of reliability/latency.

  2. Apply smoothing to enhance your results.

Another deviation on the said above, which I've used before, would be to create a weighted mean function, where you give less weight to new points of data the higher the delta is from previous points. This helps filter out erratic noise spikes, but has limited effect on subtle noise, and is pretty laggy.

Either way, good luck :)

[Late Edit:] Just noticed you mentioned the issues you encounter stem from subtle continuous noise. In which case, if you haven't done so already, it could be simply solved by adding a minimal treshold and avoiding the headache of improving your signal

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Oct 02, 2013 at 08:43 AM 1
Share

"Just noticed you mentioned the issues you encounter stem from subtle continuous noise. In which case, if you haven't done so already, it could be simply solved by adding a $$anonymous$$imal treshold and avoiding the headache of improving your signal"

$$anonymous$$artin, I have fooled extensively with "Leap" and you hit the nail on the head, that's the approach that works.

t's worth noting that all of Leap's unity example code and "convenience code" is utterly, totally, useless trash Just look in their API for the many underlying calls (ie .. "how many millimetres away from the leap device is the user's left penis" etc etc) and proceed from there!

avatar image Daniel G · Oct 02, 2013 at 11:43 AM 0
Share

@Fattie @$$anonymous$$artinCA This Threshold you all are talking about is this a simple math equation? Do you have documentation to share? $$anonymous$$aybe some examples? In the mean time ill try to figure out what your talking about :D

Fattie LOL! Yea I started with just simple simple things like velocity roll pitch yaw ect :D but yes the reason why is those example unity projects were made before the devices SD$$anonymous$$ was enhanced for more simple ways to call different things such as Roll (used to be 10 lines of code, now its one :P)

avatar image MartinCA · Oct 02, 2013 at 11:49 AM 0
Share

Treshold refers to a $$anonymous$$imum tolerance.

Consider this:

 Vector3 currentLeapPosition = GetLeapPositionSomehow();
 
 float d = ( m_previousLeapPosition - currentLeapPosition ).magnitude;
 
 m_previousLeapPosition = currentLeapPosition;
 
 if ( d < m_movementTreshold )
 {
     return;
 }
 
 DoWhateverYouWantToDoWithNewPosition( currentLeapPosition );

Simply sample each frame and retain a 1 frame history. If the change over those two frames is below a $$anonymous$$imal value ( defined in m_movementTreshold ), you simply ignore the movement.

Next all you have to do is adjust your treshold level value to filter out small noise.

avatar image Fattie · Oct 02, 2013 at 02:00 PM 0
Share

I totally threw up a LEAP indiegogo campaign !!

http://answers.unity3d.com/questions/498801/is-there-yet-a-leap-motion-for-unity.html

a few people joined in but unfortunately I didn't get a chance to spend any time building it up.

i have an excellent idea for using Leap in the actual unity editor (nothing to do with your problem, $$anonymous$$, I mean "for us developers" - not for use "in apps") so if I ever get some time I'll work it up a bit more.

Heh! what a world eh

avatar image Daniel G · Oct 02, 2013 at 04:34 PM 0
Share

@$$anonymous$$artinCA Okay I see what you mean, this makes good sense, Ill see if I can do that! Thank you!

@Fattie Yes I saw that :P What a small world of devs for Leap lol got $$anonymous$$e off of ebay just started this last month :P

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

iTween Visual Editor Event Call from C# to Javascript 1 Answer

Parent Object Via Code C# 3 Answers

How to exclude Player from Picking himself up! C# 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges