Announcement

Collapse
No announcement yet.

Device rotation as input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Device rotation as input

    I'm sure I'm just missing something, but I'm trying to use the device's rotation as an input (so something "falling" always goes toward the "real" ground, whichever way "down" really is). I thought Tilt would be what I wanted, but it seems to be a value of -2 to +2. Rotation Rate is the amount of change, so holding it still (in any orientation) gives a 0.

    It's the "z" axis, if you look at the diagram here (image also attached): https://developer.android.com/refere...re/SensorEvent
    Is there a different input event I should be using? Or maybe a combination of several?

    Thanks in advance


    Click image for larger version

Name:	axis_device.png
Views:	46
Size:	19.0 KB
ID:	1705980

    #2
    Figured it out. I don't know why the axis values from the input settings are just floats, but using GetInputMotionState, from the player controller, gives a vector, which can then be converted into a rotator, and the Z (Yaw) of the rotator is exactly what I was looking for.

    Attached Files

    Comment

    Working...
    X