Using Vectors in Processing

In our workshop we learnt how to code to simulate different forces, including velocity and gravity. We learnt how to create a simple ‘bouncing ball’ simulation using PVectors of position, velocity, gravity, force, and centre. Vectors are used to simulate the forces by using direction and magnitude, in a sense getting something from A to B. The image below shows how vectors work in 3D, using x, y and z co-ordinates.

555px-3D_Vector

Like we did in our workshop, we simulated real forces like gravity and velocity to make them react like they would do in a real life environment. This is perfect for our project of having to make an interactive graphic as it makes it more real for the users who would be in the environment and therefore heighten the interaction. Below is the code we used to simulate a bouncing ball, this is a good example to use as it uses numerous different forces but it is simple to understand. We learnt new language through doing this example, including .get, .set, .sub, .mult and .add.

Screen Shot 2014-11-27 at 13.25.07

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s