Sensor Camera: ✅ Gyroscope & Accelerometer — Unity Asset

Sensor Camera — cross-platform First Person Camera Controller (FPS Game view). It automatically selects a Motion Sensor (Gyroscope or Accelerometer) on Mobile Devices or Mouse + Keyboard on Desktop Platforms.

Read Documentation.

Resources

1 Like

Use Cases of Sensor Camera

With adding live video input from the Back/Rear Camera of a Mobile Device, Sensor Camera can be used as a “Pseudo AR Camera” to display 2D or 3D objects as though they were in the real world.

This technique was implemented in AR Camera Lite.


AR Shooter.


AR Basketball.

Sensor Camera :star: Update

1.2:

Fixes:

  • Camera Y Rotation Sensitivity with Accelerometer for Different FPS.

1.1 (New Settings of Accelerometer – can be set in Unity Editor):

Features:

  • Checkboxes for Testing:
    • Is Accelerometer Unsupported Not In Editor Test;
    • Is Accelerometer Supported In Editor Test.
  • Events:
    • On Accelerometer Initialized;
    • On Accelerometer Is Not Supported.

Improvements:

  • Unity 2021.3.21.

I released the Sensor Camera 2.0 for Unity 2022.3.6 with WebGL Support via HTTPS for Android

But Why is WebGL only available for Android? Because the Unity WebGL platform has a bug on iOS in Safari and Chrome with Orientation Changing:

when you change device orientation during the game, then it is not defined correctly sometimes. Solution: warn the player about making correct orientation before starting of Unity Project on a new tab.

At the same time, I tested a standalone app on the iOS platform: works like a charm!


All Tested Platforms are here:

Mobile Platforms with Motion Sensors:

  • iOS on iPhone 8, XS Max;
  • Android on Samsung Galaxy A71;
  • WebGL (Android) in Google Chrome.

Desktop Platforms with Right Mouse Button (for those who want a similar and seamless experience on all platforms):

  • Windows;
  • macOS;
  • WebGL in Google Chrome.

Today, I submitted 2 Bug Reports to Unity related to the next issues:

  • [WebGL > iOS]: Incorrect Orientation Changing, which leads to publishing without issues to the [WebGL > Android] platform only, as well as to iOS and Android platforms [standalone].
    • Resolving this bug by Unity will lead to the opportunity to publish WebGL apps for iOS.
  • [iOS]: Delay and Freezing in Unity’s New Input System related to the Attitude Sensor. This bug doesn’t influence the asset because for iOS and Android standalone platforms it uses Input Manager instead (Unity’s Input System by Default).
    • But resolving this bug by Unity will lead to further asset upgrading and smooth development.

Bug Reporting took several hours.

For your clear understanding, Working Platforms with Motion Sensors at this moment:

  • iOS on iPhone 8, XS Max;
  • Android on Samsung Galaxy A71;
  • WebGL (Android) in Google Chrome.

I continue to work, stay tuned. The Unity Asset is Here: Sensor Camera.


You can vote for the bug resolving on Unity Issue Tracker. Please vote.


1 Like

Tutorial: How to Build & Test Sensor Camera for Mobile WebGL

> Complete Article with all Links and Commands <

Unity Asset: Sensor Camera



You also can vote for another the bug resolving on Unity Issue Tracker. Please vote.


Workaround for iOS WebGL: warn the player about making correct orientation before starting of Unity Project on a new tab.

I released the Sensor Camera 2.1 for Unity 2022.3.18 with WebGL Support via HTTPS for iOS

The bug with orientation changing was fixed by Unity without confirmation. The previous state of bug was “Won’t Fixed”. Today I updated the ticket in Unity’s Jira and status was changed to “Active”.

I tested with Google Chrome on iPhone XS Max, Unity 2022.3.18, Input System 1.7.0 and my Sensor Camera asset. I can see that orientation changes to correct orientation after setting the wrong orientation. So the problem was resolved.

1 Like

I’ve got a New User Review :star: :star: :star: :star: :star:

Get Sensor Camera (Unity Asset).

Sensor Camera :star2: 3.0 :star2: Update

Improvements:

  • Unity 6000.0.28.
  • URP (New Standard in Unity starting with Unity 6): instead of BRP.
  • Input System (New Standard in Unity) for All Camera-related Scripts: instead of Input Manager.
  • User Input on Desktop Platforms in the Build and in the Unity Editor:
    • Spectator (Flythrough) Mode with Smooth Movement using WASDQE keys.
    • Smooth Camera Rotation using the Mouse with or without the custom mouse button pressed.

Resources

Sensor Camera :star: 3.1 :star: Update

Features:

  • New Menu Scene with Mode Selection: Gyro, Accelerometer, No Sensors, Default.

Improvements:

  • Unity 6000.0.38.
  • Clear Tutorials for All Modes on the Demo Scene.

Fixes:

  • The case when there are no sensors and mouse.

The Updated Sensor Camera plugin for Unity is already included in the AR Bundle.

Great News! One more Unity Bug related to the Gyroscope will be fixed to make the Sensor Camera perfect.

There is some magic with Unity and LinkedIn :crystal_ball:

From time to time, I click “Connect” when Unity Developers are recommended to me to keep up to date with the Gaming Industry.

This happened on the same day when my 2 years old Bug Report about Gyroscope got another move.

But if earlier the name of the responsible employee was displayed in Unity’s Jira, now it wasn’t, and I had no idea who fixed the error.

It’s amazing that Unity employees are quite friendly and open to communication. This is my 2nd such experience out of 2 - the result of a 100% success rate.


So, my Sensor Camera strives to be an ideal asset.

Disclosure: I have received permission to post this dialogue from @Evaldas_Unity — your privacy at first for me. Evaldas notes however that there are no promises and ETA.

1 Like

Use Case of Sensor CameraThrow Flow Game