I'm having trouble visualizing the accelerometer values

I unfortunately am in group 5 so I won't get my PD till next year, so I only have the simulator

A gamer has suggested I automatically rotate the screen based on what direction the system is being held in, but I have no idea what those values would be (It'd be nice if the simulator would visualize the orientation of the PD with a basic 3D model or something)

Does anyone know what kind of values I'd be getting for it being held so:

  • Top of the system is pointing up (held normally)
  • Left edge of system is pointing up/crank edge is pointing down (system is rotated clockwise)
  • Right/crank edge is pointing up/left edge is pointing down (system is rotated counter-clockwise)

The arrow in the simulator always starts pointing down, is that supposed to mean the arrow points to where down is?

Hi @NeoTechni

The docs have a paragraph on this

Positive x points right, positive y points to the bottom of the screen, and positive z points through the screen away from the viewer. For example, with the device held upright this function returns the values (0,1,0). With it flat on its back, it returns (0,0,1).

So in your case it is the x and y value you want to be looking at.

Here is my little auto rotation detector.

I only support rendering in crank-up rotated portrait mode, but the playdate has an upside-down mode toggle in the system settings which then translates here to an crank-down rotated portrait mode, if that is what the player needs for any reason.

1 Like

I'm aware of that paragraph, but it's still unclear hence why I asked for the actual example data

Points right for example, doesn't say what is pointing right

Positive x points right

The positive x axis increases in value as it goes to the right. etc

I'm sorry but the documentation already said that, it's still not clear what the data represents.

What is going right? What is the accelerator pointing towards?

What values would it give is the left edge was straight up, and same for the right edge?

The centre point of each x,y,z axis is the device.

Moving it right will increase x, as the "Positive x (axis) points right" etc.

Here's a diagram that represents the wording in the documents, each device with an accelerometer might orient these axes differently, which is why you need a statement in the docs explaining their setup:

If you use the Simulator and go into Settings > System > Input Test you can see "live" values from the accelerometer arrow on the Simulator, or from a connected device:


Change in accelerometer values represents movement.

A device that is not moving will have static accelerometer values.

As shown in the above image, with the device "stood up" normally: (0,1,0)
Stoof on its head: (0,-1,0)

Laying on its back: (0,0,1)
Laying on it's screen: (0,0,-1)

Standing on it's left side: (-1,0,0)

Stood at an angle on the bottom left corner near the dead: (-0.7,0.7,0)
Which is between "standing" (0,1,0) and standing on its left edge (-1,0,0)

1 Like