Rotate character along with device.
How do you make an actor rotate along with the device so that it appears to not be rotating. Here is an image example of it.
![image](http://img96.imageshack.us/img96/8181/rotateexample.png)
Notice how the actor is always faceing the same direction no matter how the device is rotated. How would I achieve this effect?
![image](http://img96.imageshack.us/img96/8181/rotateexample.png)
Notice how the actor is always faceing the same direction no matter how the device is rotated. How would I achieve this effect?
Best Answer
-
Socks London, UK.Posts: 12,822
"You can't just choose accelerometer, you have to choose from the accelerometer submenu which is X, Y, and Z."
I understand that, I am just responding to your question with the basic idea of how it is done, but if trying it out for yourself is too much bother let me do it for you (as you've been so charming) : ) . . . . . .
(I will be back in 2 minutes with the answer).
. . . . .
Here you go:
Constrain Attribute:
self.Rotation
game.Accelerometer.Y *90
.
Answers
: )
The code (above) suffers from one problem, as the accelerometer is so sensitive the object you want to keep upright tends to jitter around a little (as it closely tracks every little tremble and shake your hands make).
For a smoother motion (albeit less responsive) maybe also try using something like:
Timer:
Every 0.2 seconds
Interpolate
Interpolate attribute - self.rotation to game.Accelerometer.Y *90
Duration 0.5