
3.3: Angles and Vectors - Nature of Code
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
Other Videos By The Coding Train
2021-03-05 | Guest Conductor: Twirling Tech Goddess |
2021-02-27 | Coding Train Live! |
2021-02-22 | Coding Challenge #160: Spring Forces |
2021-02-20 | Coding Challenge #159: Simple Pendulum Simulation |
2021-02-16 | 3.7: Additive Waves - The Nature of Code |
2021-02-13 | Coding Train Live: Self-Avoiding Walk and Discord bot |
2021-02-12 | 3.6 Graphing Sine Wave - Nature of Code |
2021-02-07 | 3.5 Simple Harmonic Motion - Nature of Code |
2021-02-06 | Coding Train Live! |
2021-02-06 | 3.4 Polar Coordinates - The Nature of Code |
2021-02-02 | 3.3: Angles and Vectors - Nature of Code |
2021-01-29 | 3.2 Angular Motion - Nature of Code |
2021-01-26 | 3.1 Angles and Rotation - Nature of Code |
2021-01-23 | Coding Train Live! |
2021-01-16 | 2021 Choo Choo! |
2021-01-15 | Discord Bots 6: Building a Command Handler |
2021-01-08 | 2021 Choo Choo! |
2020-12-23 | Processing Foundation Holiday Telethon 2020 |
2020-12-17 | Winter Show 2020 (ITP/IMA/IMA Low Res) |
2020-12-17 | Discord Bots 5: Posting GIFs |
2020-12-12 | Advent of Code (Side Project Saturday!) |