[ad_1]
Recreation Growth Stack Trade is a query and reply website for skilled and impartial sport builders. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
The most effective solutions are voted up and rise to the highest
Requested
Considered
19 instances
Given a Vector2(x,y) that represents an object’s velocity, like so:
let angle = Math.PI / 2;
let velocity = 500;
let velocity = new Vector2();
velocity.x = Math.cos(angle) * velocity;
velocity.y = Math.cos(angle) * velocity;
How will you retrieve the velocity?
let angle = Math.atan2(velocity.y, velocity.x);
// let velocity = ???
CAOakley is a brand new contributor to this website. Take care in asking for clarification, commenting, and answering.
Take a look at our Code of Conduct.
$endgroup$
0
Was in a position to get the reply as:
let velocity = Math.sqrt(velocity.x ** 2 + velocity.y ** 2)
CAOakley is a brand new contributor to this website. Take care in asking for clarification, commenting, and answering.
Take a look at our Code of Conduct.
$endgroup$
0
default
[ad_2]

Leave a Reply