Discuss Scratch

FoxxitatorIGuess
Scratcher
7 posts

Making Bullets turn with their x speed and y speed

I have these bullets that are affected by gravity, and since I don't know I wanted to ask here.
How would I make these bullets turn based on their trajectory? Having them stay the same direction they started looks odd.

mip67
Scratcher
68 posts

Making Bullets turn with their x speed and y speed

what do you mean trajectory? if you mean the x and y speeds you could use an equation using
 (x position) 
and
 (y position) 
to get a new
 (direction) 

Last edited by mip67 (Oct. 6, 2022 19:25:26)

FoxxitatorIGuess
Scratcher
7 posts

Making Bullets turn with their x speed and y speed

It's a bit difficult to explain since I'm not sure about what kind of terms to use but basically,





Unfortunately I'm not experienced enough in math to know how to do that.
FoxxitatorIGuess
Scratcher
7 posts

Making Bullets turn with their x speed and y speed

mip67 wrote:

what do you mean trajectory? if you mean the x and y speeds you could use an equation using
 (x position) 
and
 (y position) 
to get a new
 (direction) 

It's a bit difficult to explain since I'm not sure about what kind of terms to use but basically,





Unfortunately I'm not experienced enough in math to know how to do that.

(sorry for repost, forgot you could quote things and don't know how to delete messages)
Jareddddddd
Scratcher
1000+ posts

Making Bullets turn with their x speed and y speed

hi, theres an equation for this, provided you have an X and Y velocity variable.
point in direction (([atan v] of ((Xvelocity) / (Yvelocity))) + (<(Yvelocity) < [0]> * (180))
youll learn this later, and it may be wrong. Message back if its wrong

Last edited by Jareddddddd (Oct. 6, 2022 20:58:15)

FoxxitatorIGuess
Scratcher
7 posts

Making Bullets turn with their x speed and y speed

Jareddddddd wrote:

hi, theres an equation for this, provided you have an X and Y velocity variable.
point in direction (([atan v] of ((Xvelocity) / (Yvelocity))) + (<(Yvelocity) < [0]> * (180))
youll learn this later, and it may be wrong. Message back if its wrong

That works perfectly, thank you!

Powered by DjangoBB