I’ve been starting programming simple character movements and I was wondering if anyone could explain how to cap a maximum valu Appvn e for the gravity scale of the rigid body component, Are there any legendary professional programmers that could help a basic SHAREit
I am far away from a legendary professional programmer but your solution should be easy. First off, you can control the gravity scale of a rigidbody2D by accessing that property. Second, i dont understand what you mean by setting a maximum value. Well, I do, but i dont know why you are increasing the gravity scale constantly. Like for my game, gravityScale on the player is set to 8 at one point and then 12.5 at another. It doesnt gradually transition or go higher, it is literally only one of those 2 values.
But…if you want an actual answer to your question in case you are tweaking the gravity scale really high: You can set a limit with an If function.
Basically,
if(rb.gravityScale <= 20)
{
Do stuff here
}
else
{
return;
}
That way nothing will run unless it is under a certain gravity scale value.