Using devicemotion event to control Car
This car reacts to the orientation of your smartphone. ↶📱↷
Demo Live: https://hiteshsahu.com/BMW
- Left & Right Phone tilt for steering the Car ↶📱↷
- Vertical Phone tilt accelerate/deaccelerate the Car
On PC controls are usual:
- Use W, S, A, D to Drive the Car
Body, hood, glass and Wheel’s rim material are fully customizable PBR Material.
Click/Tap: Throw Metal Balls(try Breaking window Glass)
Switch On/Off Car’s Lights
Other features Somehow Inspired by God’s Trance Playlist:
- Black & White Pass
- Emit dust Particle When Drives
EXCELLENT!!! pinging @PirateJC
Wow great! Does the accelerometer work on any phone or tablet devices? I’m curious to know how you got that to work in the browser? Thanks!
Yes Accelerometer works on any phone or tablet.If you open this demo in your smartphone then you can steer this car by tilting your phone.
If you rotate your phone horizontally then it will steer car and if you rotate your phone vertically then car will accelerate and decelerate.
I have tried many times on my 2 iPhones and multiple browsers, but unfortunately I couldn’t get any of the accelerometer to work in the browser. Please advise!
Does this demo work on iPhone? i have not tried on apple devices. You can try this link for texting of sensors Demo - The Web's Sixth Sense: A Study of Scripts Accessing Smartphone Sensors
I like it, very nice was this a hobby project or something required by a client?
This was the hobby project. I had seen this car demos long time back so I always wanted to make one myself:
When Elon Musk announced Cybertruck I decided to make a Cybertruck with BabylonJS. First I made a simple scene with Cybertruck that you can drive. Then I added some obstacles, traffic cones, glass breaking effect and jump tracks. It was a great learning.
Cybertruck Demo: https://hiteshsahu.com/cybertruck
After that I applied my learning to make this BMW project. I would say BMWi8 is the next iteration of the Cybertruck experiment.
BMWi Demo: https://hiteshsahu.com/BMW