• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android How to tilt while phone is flat

N

ndaoud360

Guest
I have this for tilting

Code:
image_angle = point_direction(0,0,device_get_tilt_x(),-device_get_tilt_y())
but it seems to only work properly when holding the phone upright (portrait or landscape)
holding the phone flat (which is what I need) makes the object spaze out but still tilts.
 
T

TinyGamesLab

Guest
If the device is flat, you won't be able to use the accelerometer to do the tilting since there won't be any acceleration change due to the gravity in any of the accelerometers.
You best bet in this case is to use the compass (I believe there is an extension in the marketplace for that).
Rgds,
Tinygameslab
 
If the device is flat, you won't be able to use the accelerometer to do the tilting since there won't be any acceleration change due to the gravity in any of the accelerometers.
If the device is flat, the Z-Axis will still register a downward acceleration due to gravity.

@ndaoud360 Have you tried using device_get_tilt_z() as one of your axis?
 
T

TinyGamesLab

Guest
If the device is flat, the Z-Axis will still register a downward acceleration due to gravity.

@ndaoud360 Have you tried using device_get_tilt_z() as one of your axis?
You are correct, if there is any tilting of the z axis it should register. If @ndaoud360 is only spining the device while holding it flat (like with the device positioned over a flat surface at all time) I don't think it will work.
 
N

ndaoud360

Guest
If the device is flat, you won't be able to use the accelerometer to do the tilting since there won't be any acceleration change due to the gravity in any of the accelerometers.
You best bet in this case is to use the compass (I believe there is an extension in the marketplace for that).
Rgds,
Tinygameslab
Totally forgot about the compass, that would definitely be what I need. I'll check it out.
 
N

ndaoud360

Guest
If the device is flat, you won't be able to use the accelerometer to do the tilting since there won't be any acceleration change due to the gravity in any of the accelerometers.
You best bet in this case is to use the compass (I believe there is an extension in the marketplace for that).
Rgds,
Tinygameslab
I got around to checking out the compass extension. Will it allow me to rotate using tilt because I fell like, if tilting in general while flat spazs out, then won't it make the compass spaze out?
 
Top