Contrain actor position based on accelerometer

sebmacflysebmacfly Member Posts: 1,018
edited June 2012 in Working with GS (Mac)
Hi :)

I'm getting mad lol...
I don't know how to constrain the X position of my actor, based on the X accelerometer...

For exemple, if accelerometer.X =0, my actor position have to be 160, if accelerometer.X=+1 position =300
if accelerometer.X =-1 position=20

Any help on how to make it work?

see this picture to see wht i need (i have to constrain the yellow actor Y position, based on the Accelerometer.X value)

Thank you :)

image

Best Answer

  • master200012master200012 Posts: 372
    Accepted Answer
    Constrain attribute: self position y to:
    160+(accelerometer value * 140)

    Make sure you've constrained the position (x) of the actor as well.

    Not sure if this is what you're looking for, but I hope this helps.

Answers

  • sebmacflysebmacfly Member Posts: 1,018
    edited June 2012
    In the picture, the Accelerometer.X value=+0.2 and my actor Y position would be about 180
  • sebmacflysebmacfly Member Posts: 1,018
    Perfect! Thanks ;)
Sign In or Register to comment.