Discuss Scratch

Astora
Scratcher
24 posts

X and Y Velocities to Angular Velocity

In my pendulum project on my test account, https://scratch.mit.edu/projects/276462111, I have used trigonometry to convert angular velocities to indivdiual x and y velocities. However, I need to convert them again back to angular velocities.
I found this formula here: https://scicomp.stackexchange.com/questions/11353/angular-velocity-by-vector-2d ,
ω=rxvy−ryvx/r2x+r2y (can't copy and paste correctly), where ‘ω is the angular velocity, r is the vector from the center of rotation to the point under consideration, and v is the velocity vector’. By ‘r is the vector from the center of rotation to the point under consideration’ just mean the radius? If not, what does it mean and does anyone know another way to convert 2 values, that being an x and y velocity to a single angular velocity?
game_pr0grammer
Scratcher
500+ posts

X and Y Velocities to Angular Velocity

Astora wrote:

{does} “r is the vector from the center of rotation to the point under consideration” just mean the radius?

game_pr0grammer wrote:

yup

also, maybe you could get the magnitude of the velocity like this
definegetmagnitudexysetreturn magnitudetosqrtofx-x^2+y-y^2there is no (b ^ 2) operator, just use (b * b)whenclickedwaitwhywouldyouuse"whenclicked"onsomethinglikethis?getmagnitudexVyVsetangVtoreturnmagnitude
idk lol
Astora2
Scratcher
8 posts

X and Y Velocities to Angular Velocity

game_pr0grammer wrote:

Astora wrote:

{does} “r is the vector from the center of rotation to the point under consideration” just mean the radius?

game_pr0grammer wrote:

yup

also, maybe you could get the magnitude of the velocity like this
definegetmagnitudexysetreturn magnitudetosqrtofx-x^2+y-y^2there is no (b ^ 2) operator, just use (b * b)whenclickedwaitwhywouldyouuse"whenclicked"onsomethinglikethis?getmagnitudexVyVsetangVtoreturnmagnitude
idk lol

the get magnitude block doesn't make sense? x-x would always equal 0, as would y-y?
HowToLogic
Scratcher
34 posts

X and Y Velocities to Angular Velocity

Astora wrote:

In my pendulum project on my test account, https://scratch.mit.edu/projects/276462111, I have used trigonometry to convert angular velocities to indivdiual x and y velocities. However, I need to convert them again back to angular velocities.
I found this formula here: https://scicomp.stackexchange.com/questions/11353/angular-velocity-by-vector-2d ,
ω=rxvy−ryvx/r2x+r2y (can't copy and paste correctly), where ‘ω is the angular velocity, r is the vector from the center of rotation to the point under consideration, and v is the velocity vector’. By ‘r is the vector from the center of rotation to the point under consideration’ just mean the radius? If not, what does it mean and does anyone know another way to convert 2 values, that being an x and y velocity to a single angular velocity?

Well to get the angle of the velocity you can use:
(atan(x/y))+(180*(y<0))

To get the magnitude:
sqrt(x*x+y*y)

And to convert from angular to x and y.

x = magnitude*sin(angle)
y = magnitude*cos(angle)


Hope this helps
Locomule
Scratcher
1000+ posts

X and Y Velocities to Angular Velocity

just use this

foreversetdirectionto1repeat90pointindirection100*cosofdirectionchangedirectionby4turn180degrees

example (look in Pendulum sprite)

Last edited by Locomule (Jan. 11, 2019 14:48:59)

Locomule
Scratcher
1000+ posts

X and Y Velocities to Angular Velocity

this Cosine method also makes a great jump when you don't need gravity like for a simple runner as it always returns to the same ground level, no collision detection needed
https://scratch.mit.edu/projects/13055322/

Last edited by Locomule (Jan. 11, 2019 14:53:58)

Powered by DjangoBB