Negative Acceleration?

Physics.gravity = Vector2(iPhoneInput.acceleration.x * 40, iPhoneInput.acceleration.y * 40);

How would I negate this? I tried .-x and .- y but Unity throws the error "expecting ), found ‘.’ ".

I’m trying to have the iPhone acceleration control gravity in horizontal mode. (This works as expected in Vertical mode). I have set iPhoneSettings.verticalOrientation = false, but this doesn’t matter. Any ideas? Thanks,

brandon

-iPhoneInput.acceleration.y

–Eric

Thanks alot! I also had to switch the x and y coordinates. I guess the axis in game doesn’t rotate along with the iPhone’s accelerometer by default, you have to manually put each axis into place.

Physics.gravity = Vector3(-iPhoneInput.acceleration.y * 60, iPhoneInput.acceleration.x * 60, 0);

Thanks again,

brandon

blt3d : Take a look at this page:

http://blog.digitalagua.com/2008/07/15/accelerometer-xyz-based-on-iphone-position/

and this topic:

http://forum.unity3d.com/viewtopic.php?t=20594

to help get your head around the accelerometer…

Thanks for the info! Very helpful.