playMaker

Author Topic: How to map Device Acceleration to XZ Axis Movement  (Read 1859 times)

rndmoo

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
How to map Device Acceleration to XZ Axis Movement
« on: August 08, 2011, 08:27:25 AM »
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

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to map Device Acceleration to XZ Axis Movement
« Reply #1 on: November 29, 2011, 12:17:19 PM »
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.