physics – Getting the scalar velocity from an X and Y velocity

physics – Getting the scalar velocity from an X and Y velocity

[ad_1]

physics – Getting the scalar velocity from an X and Y velocity – Recreation Growth Stack Trade







Recreation Growth Stack Trade is a query and reply website for skilled and impartial sport builders. It solely takes a minute to enroll.

Signal as much as be a part of this group

Anyone can ask a query

Anyone can reply

The most effective solutions are voted up and rise to the highest

Requested

Considered
19 instances

$begingroup$

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

$begingroup$

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]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Scroll to Top