Giter Site home page Giter Site logo

ivanmurzak / unity-gyroscope-parallax Goto Github PK

View Code? Open in Web Editor NEW
80.0 2.0 8.0 1.53 MB

Unity Parallax based on gyroscope components.

License: MIT License

Batchfile 10.73% C# 89.27%
unity unity-package unity-plugin unity2d unity3d unitypackage unityplugin gyroscope parallax parallax-effect

unity-gyroscope-parallax's Introduction

Unity-Gyroscope-Parallax

npm openupm License Stand With Ukraine

Unity Parallax based on gyroscope components. Supported fake gyroscope for simulation in Unity Editor. Alternative version to Unity-Mouse-Parallax.

Features

  • ✔️ support legacy Input System
  • ✔️ support new Input System
  • ✔️ ability to simulate gyroscope in Unity Editor
  • ✔️ move/rotate objects based on gyroscope
  • ✔️ ability to add custom controllers

unity-gyroscope-parallax-small

GyroMover2D

Moves list of objects using gyroscope.

image image

Unity_WTZrJSE6qY

GyroRotator2D

Rotates list of objects using gyroscope.

image image

Unity_CeUGRyFD5v

How to install - Option 1 (RECOMMENDED)

  • Install OpenUPM-CLI
  • Open command line in Unity project folder
  • openupm add extensions.unity.gyroscope.parallax

How to install - Option 2

  • Add this code to /Packages/manifest.json
{
  "dependencies": {
    "extensions.unity.gyroscope.parallax": "1.4.1",
  },
  "scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "extensions.unity",
        "com.cysharp",
        "com.neuecc"
      ]
    }
  ]
}

How to use

  • add needed Gyro...2D component to any GameObject
  • link Targets to list of targets
  • press 'Play' button in Unity Editor
  • find Fake Gyroscope Manager in DonDestroyOnLoad scene (appears in Play Mode)
  • image
  • change XY values of Gravity and Attitude properties to simulate gyroscope in Unity Editor

unity-gyroscope-parallax's People

Contributors

ivanmurzak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

unity-gyroscope-parallax's Issues

'Sirenix' could not be found

Hey, I'm getting the following error when I try to edit the manifest.json file.

Library\PackageCache\[email protected]\Scripts\Mover2D\GyroMover2D.cs(2,7): error CS0246: The type or namespace name 'Sirenix' could not be found (are you missing a using directive or an assembly reference?)

Unity version: 2021.3.11f1

Resolve "Gimbal Lock" problem by using Quaternion for rotation

I love this tool!

Just a quick question: In the first screenshot, that's how I want it to start when the user holds the phone vertically. Currently, it starts like in the second screenshot. When I place my mobile on a table, it looks like the first screenshot. Do you know how I can fix this?

If I have a Gyro rotator and a rotator attitude on this cube with a max offset of 30 on the Y. My phone starts at -30. I want this to be 0

Screenshot1
Screenshot2

Changing sample rate doesn't do anything. Stuck at 0.02 update interval

The default value for gyro update interval automatically gets set to 0.02f even when I change the default sampling frequency on the gyroscope script.

I have tried the following:

`float gyroRate = 0.1f;
Input.gyro.updateInterval = gyroRate;
AttitudeSensor.current.samplingFrequency = Mathf.RoundToInt(1 / gyroRate);
GravitySensor.current.samplingFrequency = Mathf.RoundToInt(1 / gyroRate);

gyroscopeManager.SamplingFrequency = Mathf.RoundToInt(1 / gyroRate);
gyroscopeManager.RefreshGyroState();`

Calling RefreshGyroState does not enable the devices again and no parrallax/gravity happens.
Is there something I am missing?

Although I can change Input.gyro.updateInterval without calling RefreshGyroState, it does not update the new InputSystem sensors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.