- Home /
Creating a Unity Tiny game in a mobile browser that reads phone rotation/tilting (accelerometer) as an input
I'm trying to create a vertical snow boarding game that steers using rotating/tilting the phone.
Knowing that Javascript has access to the phone's accelerometer but Unity Tiny doesn't, I tried doing this: https://forum.unity.com/threads/can-the-typescript-engine-run-regular-javascript-code.594064/#post-3968980
Right now I can execute javascript functions that read the phone's rotation on a Unity Tiny game. The problem is that I cannot execute Unity Tiny's Typescript function (to steer the snow board) from my javasript everytime I detect a rotation.
I am thinking of forcing/simulating a keypress event in javascript and use that as an input for Unity Tiny Typescript since it has input handlers for keypress. Haven't tried this yet though and I am not very comfortable with this approach.
Please let me know if there is a better way to do this. TIA
Your answer
![](https://koobas.hobune.stream/wayback/20220612193625im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
When moving two or more sprites or widgets, one image is taken off the screen. 0 Answers
How do I load a Camera into a prefab that isn't in the scene? 1 Answer
Script working in Editor, not working when Build and Run 2 Answers
object is visible in scene tab and game tab but not in playmode in unity 0 Answers
Unity opens but displays nothing. How can i fix this? 0 Answers