[Bf-committers] Sensors API for GE on Android

Dalai Felinto dfelinto at gmail.com
Fri Jul 20 08:52:58 CEST 2012


Hi, as a reference I ran into that example of gyroscope input with html5:
http://www.peterfriese.de/how-to-use-the-gyroscope-of-your-iphone-in-a-mobile-web-app/

It's using alpha, beta and gamma. I don't know if it's the delta
roll/pitch/tilt or the absolute. I can use usages for either way.

> quat = bge.logic.gyroscope.angular_velocity  # rotation as a quaternion
I like this, but it would be handy to also have:
bge.logic.gyroscope.orientation(origin=quat(0.0.0.1))
#the absolute orientation, optionally passing a new origin orientation.

--
Dalai

2012/7/19 Campbell Barton <ideasman42 at gmail.com>

> Hi, adding a python api to begin with seems reasonable (keep in mind
> we may wan't C/api for other parts of blender to access but this
> shouldn't be a problem)
>
> Check on...
>
> http://www.blender.org/documentation/blender_python_api_2_63_release/bge.logic.html#bge.logic.mouse
>
> http://www.blender.org/documentation/blender_python_api_2_63_release/bge.events.html
>
> There could be...
>
> bge.logic.gyroscope
> bge.logic.gyroscope.is_connected
> bge.logic.gyroscope.activate()
> bge.logic.gyroscope.deactivate()
> quat = bge.logic.gyroscope.angular_velocity  # rotation as a quaternion
> data = bge.logic.gyroscope.data  # raw data from gyro -- if this is
> useful in some cases it have besides quaternion access.
>
>
> On Thu, Jul 19, 2012 at 12:41 AM, Alexandr Kuznetsov <kuzsasha at gmail.com>
> wrote:
> > Hi
> >
> >
> > Android and other mobile devices have different input methods than
> > traditional computers.
> >
> >
> > I wrote a mouse emulator which uses touch, but there still some problems.
> > For example, Android  knows the cursor position only when device is
> touch,
> > aka left mouse is pressed. Therefore, when we press in different places,
> > courses just jumps from one position to the next. Hopefully, it will be
> > less of a problem when we have multitouch API and can use explicitly use
> it
> > instead mouse emulator.
> >
> >
> > I want to add Accelerometer and Gyroscope this or next week.
> Accelerometer
> > and Gyroscope provide streams of information that can affect performance.
> > Therefore I think developers should explicitly enable and disable api.
> > dfelinto proposed those sensors should be implemented as python API
> first.
> >   For devices or OSs that don't have Accelerometer and Gyroscope, we can
> > provide fake api. Also, I think, gyroscope and accelerometer should use
> the
> > same api and be specified through enum and return a vector array of
> values.
> >
> >
> > How would you like to see this implemented? Also, do you want any data
> > conversions/helper functions? Gyroscope data is a little complicated:
> >
> http://developer.android.com/guide/topics/sensors/sensors_motion.html#sensors-motion-gyro
> >
> >
> >
> > Best,
> >
> > Alex
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
>
>
>
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list