Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with rotation
- Tsunami_trouble11
-
Scratcher
80 posts
Help with rotation
Hello! I'm working on a space game. I need with help with rotating the rocket sprite so that it points parallel to the planet, but points backwards from the rocket's ‘Parallel velocity’ relative to the planet. I'm trying to use this to simulate atmospheric drag by applying drag in the opposite direction of the parallel velocity so you slow down, but I don't know how to do what I said (probably because it barely makes sense). Hopefully this image helps to explain what I mean.
- White arrows: ‘Parallel velocity’ (What I need to find now)
- Green arrows: Drag direction (found by @deck26)

Thank you for reading!
Game shared from my alt
- White arrows: ‘Parallel velocity’ (What I need to find now)
- Green arrows: Drag direction (found by @deck26)

Thank you for reading!
Game shared from my alt
Last edited by Tsunami_trouble11 (Oct. 7, 2023 21:11:22)
- deck26
-
Scratcher
1000+ posts
Help with rotation
If the planet is properly centred you should just need to point towards the centre and then turn 90 degrees (clockwise or anti clockwise will depend on the direction of rotation but you could perhaps have a variable for that).
- Tsunami_trouble11
-
Scratcher
80 posts
Help with rotation
If the planet is properly centred you should just need to point towards the centre and then turn 90 degrees (clockwise or anti clockwise will depend on the direction of rotation but you could perhaps have a variable for that).Thank you! But, now I just realized I need to know the parallel velocity to get the proper drag direction.
Last edited by Tsunami_trouble11 (Oct. 7, 2023 17:54:13)
- ExtraMental
-
Scratcher
100+ posts
Help with rotation
Seems like you just need to do have -sin(drag dir) and -cos(drag dir) as x and y velocities.
- Tsunami_trouble11
-
Scratcher
80 posts
Help with rotation
Seems like you just need to do have -sin(drag dir) and -cos(drag dir) as x and y velocities.
Got it. I was trying to find the parallel velocity though, so I could apply drag in the opposite direction of the parallel velocity. I should have stated that in the post, sorry. I keep forgetting to put things inside the original post.
- Tsunami_trouble11
-
Scratcher
80 posts
Help with rotation
I was able to find an equation that works. Thank you guys for giving me ideas though! 

- Discussion Forums
- » Help with Scripts
-
» Help with rotation