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
2
Question by Horsepower · Mar 25, 2012 at 02:39 PM · inputgyro

Does exists a solution to remove flickering of the Wiimote gyro ?

I want know if exists a solution, or some parameters, to remove flickering of the Wii Remote Plus, because I made a little game application, that involves the Physics, but the objects flicker too:

  • In the scene, the dynamic objects slide over a table, and the Input behavior of the Wii Remote Plus gyroscope, is not the same as the input behavior of the arrow keys, on the Keyboard !

  • The flickering of input (I think), is because Wii Remote Plus, reads 60 times per second the processing signal; thus, it is not very much smoothly by rotating objects with gyroscope!

1)Does exists some adjustable parameters on “PPJoy”? (the "Timing", in the version 0.8.4.5 are disabled (grayed out), and cannot be modified at all!)

2)Does exists some options on “Glovepie 0.45”, to add some scripting line code, that smooth the rotational movements of the gyro, of the Wii Remote Plus?

3)Do anything know if exists some Physics parameters, that should be adjusted in “Unity3D v.3.4.2f5” ?

Where can I get more information?

Anyone have a suggestion?

Help, please!

Thanks! Horsepower.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by aldonaletto · Mar 25, 2012 at 03:38 PM

I don't know what exactly the gyroscope returns, but if it's a Vector3 you can use a Lerp filter to smooth out the values read - that's often used with Input.acceleration, a very jerky signal without any filtering.
Supposing you're reading the gyroscope value in a Vector3 variable called gyro, you could use this:

var smoothGyro: Vector3 = Vector3.zero; // smoothed gyro value var speed: float = 1.5; // the lower the speed, the higher the smoothness

function Start(){ while (true){ // filters the gyro value continuously: var gyro:Vector3 = //<- read the gyro value and assign it to this variable smoothGyro = Vector3.Lerp(smoothGyro, gyro, speed*Time.deltaTime); yield; // repeats the loop next update } } The variable smoothGyro contains a filtered version of the raw gyro signal - read it when needed.

Comment
Add comment · 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
0

Answer by Horsepower · Mar 25, 2012 at 05:28 PM

I don't use Input.acceleration Script.

I use GlovePIE 0.45 that interfaces to Unity3D, to have more control, and it is more simple (I think!).

Thus, Yes!: I have used "Lerp" filter to smooth out the values.

My modified "Rotate Behaviour Script", that finally I already writed, run correctly.

I hope I've done a good work to compile it, in that manner! I am not sure, but it works without errors:


var maxVert: float = 90; // define the max vertical angle (to each side) var maxHor: float = 90; // define the max horizontal angle (to each side) private var initRot: Quaternion;

function Start(){ initRot = transform.rotation; }

function Update(){ var angV = Input.GetAxis("Vertical") maxVert; var angH = Input.GetAxis("Horizontal") maxHor; var target = initRot * Quaternion.Euler(-angV, 0, angH);

// Dampen towards the target rotation

transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * 2);; }


Do it's correct?

It run OK!

And smooth very well the signal;

IF I put:

"Time.deltaTime * 1)"

it is more smoothed but exaggerated; the input command doesn't respond very quickly to gyroscope...

Instead with:

"Time.deltaTime * 2)"

it's OK!

Comment
Add comment · Show 1 · 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 aldonaletto · Mar 25, 2012 at 06:14 PM 0
Share

Yes, I think this may do the job. Should you experience any problem with Quaternion.Slerp (object rotating about the wrong axis at some points), try to smooth out the angles ins$$anonymous$$d:

var curEuler = Vector3.zero;

function Update(){ var angV = Input.GetAxis("Vertical") maxVert; var angH = Input.GetAxis("Horizontal") maxHor; // damp the angles: curEuler = Vector3.Lerp(curEuler, Vector3(-angV,0,angH), Time.deltaTime 2); transform.rotation = Quaternion.Euler(curEuler) iniRot; } NOTE: I suspect that the correct order is Quaternion.Euler(...) iniRot, ins$$anonymous$$d of iniRot Quaternion.Euler(...) - the rotations are applied right to left in quaternion multiplication. If the order is wrong, you will notice a weird behaviour only when the object has a non-zero initial rotation.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Android - Input.gyro.attitude not working 1 Answer

Gyro calibration in android? 0 Answers

Unity 3.4 Gyroscope support not there? 2 Answers

What is with Input.Gyro.UpdateInterval? 1 Answer

Why Wiimote (or Glovepie, or Unity3D...) pull in the above-left corner ? 0 Answers


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