transform.up doesn't accept float values?

Ok, so I’m wanting to change the direction in which my player’s gravity is. Not to hard by changing the player’s transform.up. Problem is, it’s only accepting either 1, or -1 values. I know I could do a whole bunch of stuff like changing the rotation on a certain axis, but it’d just be easiest to change the transform.up.

I tried to lerp it and it just wouldn’t move at all unless I set it obscenely high so it switches close enough it rounds to the opposite. The idea is to change gravity based on hitting buttons, but I don’t want it to be instant. Any ideas?

(I may just have to do it the manual way with rotation and such so that you aren’t flipped around backward or something as it transitions.)

Transform.up is a Vector3, not a float.

The lerping issue sounds like you might be trying to assign integer values to it. When truncating a float to an int they are always rounded down. So if lerping from ints to floats the change per frame would have to be higher than your frame rate for anything to happen, and then it’d look really choppy. So, make sure you’re using floating points.

When I said the floats and ints, I was talking about each individual number in the vector3. I’m using Vector3.lerp, but it’s acting like an int instead of the float it should be.

Ok, can you post your code then? We can’t really help if we can’t see what you’re doing. And the information that you have given is pretty vague and scattered and hasn’t told us what actually goes wrong when you use a float.

Also, what language are you using? If it’s C#, are you appending ‘f’ to your numbers, ie: 1.0f? If not it’ll implicitly be typed as a double, which will throw an error (they do not implicitly downcast to float).

The easiest way to change gravity direction for an object is to just turn off gravity and apply the force yourself in whichever direction you like.

Changing transform.up only re-orients the object, it has nothing at all to do with gravity, or moving via gravity.