Jack Chen
NOC Week 2 Vectors
This week, I created a 3D visualization of two planets which follows the mouse with a smaller planet orbiting a larger planet.
link to sketch:
https://editor.p5js.org/ukpfilms/sketches/SWECBJQqi

I begin the sketch with the intention to modify my second sketch from last week in order to make a 3D random walk using vectors.

When I applied vectors to last week's sketch, the cubes were clustered together; and if I draw the background every loop, I get a cube that moves around and spin really fast. This inspired me to make the shape circular instead, and I thought of making a variation of my universe visualization project from last semester, but this time with fewer planets and vector movements.
I referenced professor Schiffman's coding train videos on vectors in writing codes that sets up a vector and acceleration for objects; all I had to do to convert it into 3D is to add one more argument for Z axis for the vectors.

I decided to have two planets interact with each other in my sketch, but I'm not sure how to make it happen by having tow separate objects interact with each other, so I just put both planets into the same object class and called them in together. Even with both planets in the same class, it was still confusing to write the velocity, acceleration and rotation of the the planets, but through some trial and error I was eventually able to complete the sketch and have the small planet orbit around the bigger one while they both follow the mouse position.
This week's practice gave me a chance to familiarize the basic aspects of vectors in P5, I am excited to use vectors to simulate other interesting forces and movements in the future!