Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dove Leiger |
What is the use of Vector.aspect()? I understand what the method does, but not how or why to use it. What is a typical use case?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dove Leiger |
What is the use of Vector.aspect()? I understand what the method does, but not how or why to use it. What is a typical use case?
Reply From: | Bean_of_all_Beans |
From the documentation online:
float aspect ( )
Returns the aspect ratio of this vector, the ratio of x to y.
I did some of my own testing, and it seems to return the vector’s x-value divided by the y-value. For example, Vector2(4, 2).aspect()
will return 2.0
, since 4 / 2 == 2.0
.
Yeah, I read the documentation, I know what an aspect ratio is, and I understand what the method does; my question is what is its use? When, in game development, is it useful to know the aspect ratio of a vector, and what can be done with that information?
Dove Leiger | 2021-06-23 04:49