I want to make a game using sensor to moving component how can i achieve that? The effect something like that https://youtu.be/sFZ-IvlVTTw
Asked
Active
Viewed 231 times
1 Answers
2
Just like @Chirag Bargoojar says in the comment, you need to have a separate package to get values from the phone sensors/use the camera as a sensor, Forge2D has nothing to do with this since it is only a physics engine. But it should not be very hard to act upon input from the packages that were suggested (all_sensor
or proximity_sensor
).
Since you have written flame
in the ticket too, you'll have to use the bridge package called flame_forge2d
to use Forge2D within flame so your dependencies section of your pubspec file should look something like this:
dependencies:
flame: "1.0.0-rc5"
flame_forge2d: "0.6.0-rc2"
proximity_sensor: ^1.0.2
# or
all_sensors: ^0.3.1+2
To get bodies falling with the sensors you'll have to update the gravity in Forge2D according to the output of the sensors.

spydon
- 9,372
- 6
- 33
- 63