3.3: Angles and Vectors - Nature of Code

3.3: Angles and Vectors - Nature of Code

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=oXwCVDXS2Lg



Duration: 9:39
32,900 views
903


In this video, I tackle a common question, how do you draw an object pointing in the direction it’s moving? I demonstrate how to calculate the angle associated with the direction vector as well as create a vector from an angle in p5.js. Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/3-angles/3-angles-and-vectors

p5.js Web Editor Sketches:
πŸ•ΉοΈ Direction Pointing: https://editor.p5js.org/codingtrain/sketches/9M9yQJVVc
πŸ•ΉοΈ Vehicle: https://editor.p5js.org/codingtrain/sketches/HtXbIDsESi
πŸ•ΉοΈ Asteroids Exercise: https://editor.p5js.org/codingtrain/sketches/pXS395i0h

πŸŽ₯ Previous video: https://youtu.be/i2ROE_mAhU0?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ Next video: https://youtu.be/O5wjXoFrau4?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM

References:
πŸ”— Solving for tangent: https://natureofcode.com/book/chapter-3-oscillation/index.html#34-pointing-in-the-direction-of-movement

Videos:
πŸŽ₯ 1.4 Static Functions: https://youtu.be/YN8Q-QEmQ8Y
πŸŽ₯ Asteroids with p5.js: https://youtu.be/hacZU523FyM

Timestamps:
0:00 Hi again!
0:24 How is tangent useful and heading()
3:29 Using heading()
5:01 p5.Vector.fromAngle()
5:47 Demonstrate fromAngle()
8:13 What could you make?

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://thecodingtrain.com/discord
βœͺ Nebula: https://go.nebula.tv/codingtrain
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: https://p5js.org
πŸ”— p5.js Web Editor: https://editor.p5js.org/
πŸ”— Processing: https://processing.org

πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#forbeginners #javascript #p5js