0 votes

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?

Godot version 3.3.2
in Engine by (16 points)

1 Answer

0 votes

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.

by (329 points)

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?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.