PlayMaker Help & Tips > iOS Help

How to map Device Acceleration to XZ Axis Movement

(1/1)

rndmoo:
Hi,

Is there a clever way of mapping Device.Acceleration to XZ movement like to Character Controller with Axis Input but for Device Acceleration? Or convert Device Acceleration to Axis Input?


/glenn

Razieln64:
You'd have to check the accelerometer's position at every frame using a low pass filter and compare it to a reference vector. You then can check the direction and/or the angle from the device's orientation to the reference vector. You can use this information to move a character around, etc. For example, you can use the angle difference to determine the character's speed.

I use the accelerometer to move a character around in my current project. It's really easy once you understand how it works. Unfortunately, I only use Playmaker for AI in my game. All else uses custom scripts that are sometimes linked to Playmaker FSMs.

Navigation

[0] Message Index

Go to full version