Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

BB10 DevAlpha Accelerometer

I've just been writing the UI for a game

 

On the PlayBook it works perfectly

 

On BB10 it functions completely differently

 

My x-axis sense needs the device to be turned far further to hit the same numbers so I can trigger an action

 

Any ideas?




Click the like button if you find my posts useful!
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: BB10 DevAlpha Accelerometer

Does default orientation have anything to do with it?  Are the axes on the PlayBook different than that of the BB10 Dev Alpha due to each of them having different default orientations (PB landscape vs. BB10DA portrait)?

 

Or is what you are seeing more subtle, yet distinguishable, than that?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 DevAlpha Accelerometer

Hi everybody.

 

I also tried to work with the devicemotion and deviceorientation events to  move events using WebGL animationFrame. Referring to http://www.html5rocks.com/en/tutorials/device/orientation/ for me it seems the devicemotions eventData.accelerationIncludingGravity.y value is not the front-to-back value, I think it is the back-to-front value.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 DevAlpha Accelerometer

If holding the device in front of you...

 

X = Tip it left / right

Y = Tip it toward / away from you

 

I use a big change in the Y reading to trigger an action (jump / crouch in my little test)

 

This gives a nice simple uncluttered UI - tilt left/right to move, rapid flip forward/back to jump/crouch leaving touch free for fire

 

It all works very nicely on the PB but is wierd on the DevAlpha




Click the like button if you find my posts useful!
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 DevAlpha Accelerometer


peardox wrote:

If holding the device in front of you...

 

X = Tip it left / right

Y = Tip it toward / away from you

 

I use a big change in the Y reading to trigger an action (jump / crouch in my little test)

 

This gives a nice simple uncluttered UI - tilt left/right to move, rapid flip forward/back to jump/crouch leaving touch free for fire

 

It all works very nicely on the PB but is wierd on the DevAlpha


1.) When holding the device in my hands and Y (lock-button is "0") and X (volume-buttons are right) would be 0, then:

 

1.a) if I move it in this way that lock-button is top now the Y is way round as my objects on screen flying to the top, not falling down to the bottom.

 

1.b) back to 1.) and then if I move it in this way the volume-buttons are top now the objects are falling from right to left on the display as I would expect it to work.

 

So for me the Y values are false, they should be the way round as they are thrown in the event. That is how I understand the way X +Y are positioned in the pictures here: http://www.html5rocks.com/en/tutorials/device/orientation/


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 DevAlpha Accelerometer

A very useful tool app can be found in https://github.com/blackberry/WebWorks-Samples

 

Just compile up Kitchen Sink

 

I did a PB version and installed it on both PB and DevAlpha

 

In the 3rd section there's an accelerometer test which is very useful for experimentation




Click the like button if you find my posts useful!
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 DevAlpha Accelerometer

[ Edited ]

peardox wrote:

A very useful tool app can be found in https://github.com/blackberry/WebWorks-Samples

 

Just compile up Kitchen Sink

 

I did a PB version and installed it on both PB and DevAlpha

 

In the 3rd section there's an accelerometer test which is very useful for experimentation


So I think I need to explain little deeper how it seems to work for me and what the issue is in Relationship to the following image I created from the BB sources (please don't beat me!!)

 

xyz_PB_BB10.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This shows the device acceleration on the devices and for me the Y values thrown by the event on the BB10 are exactly the opposite direction as shown above in the image.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 DevAlpha Accelerometer


peardox wrote:

A very useful tool app can be found in https://github.com/blackberry/WebWorks-Samples

 

Just compile up Kitchen Sink

 

I did a PB version and installed it on both PB and DevAlpha

 

In the 3rd section there's an accelerometer test which is very useful for experimentation


I tried again with the example you linked me to and for me it seems to work well now on both devices PB and BB10 and I investigated and assume that my physics example was made with a bottle of beer.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.