Hi, i want to change the properties of input manager in the game.when the player press G button can change the Gravity in (Input Manager->Axes->Horizontal->Gravity) to a specific number.How to do it? thankful
It’s not currently not possible. See this post:
Make sure you vote for this feature
I came across this little Gem
I know this is quite an old post, but what you are trying to do is not to change the input manager information, but to change the world gravity information, in which case this bit of code will work. (sorry if not formatted correctly, this is my first forum post):
// To just switch gravity.
Physics.gravity *= -1;
// To set gravity to a preset value.
Vector3 preSetValue = new Vector3 (float, float, float);
Physics.gravity = preSetValue;
Remember that gravity is a force vector and therefore a V3. Also, that by default gravity is about (0.0f, -9.8f, 0.0f). But not exactly! So don’t test for that in an if statement without recording it in a V3 variable. It is NOT (0.0f, -1f, 0.0f). oh and obviously negative numbers will pull toward the ground. Numbers in the x component will pull along the x axis and numbers in the z component will pull toward the z component.
Old post, but new finders, have fun with some trippy physics!