Saturday, February 5, 2011

[Week 5] Sketch 1 Implementation Process

The Sketch 1 implementation included learning and using Max 5 visual programming interface  to create our virtual balloon passing environment. We were given template Max patches from our professor Greg Corness to work with and we modified the hitting objects(colorTracking).maxpat and Animated Image.maxpat. Our interface will involve our participant to wear a solid color glove when hitting the balloon, we are tracking the movement of the glove colour. We choose colour tracking over blob tracking because the blob tracking patch will calculate the speed from the middle portion of our body (ex. belly button) and we wanted the speed to come from our hand motion.

 The task was challenging and we had to streamline the balloon passing simulation to be more abstract and simpler, due to our time and technical skill limitations. We were able to implement two algorithms simulating the hard and soft force (qualities of motion) our participants would apply to the balloon when playing (screen shots are shown below): (1) Hard and soft interactions  (2) Hitting the Balloon to hard

(1) Hard and soft interactions - the balloon moves at the speed of the force that the participant hits it.
 
Figure 1. Detect Speed of x and y position of colour movement modified from detect_Speed.maxpat from Greg Corness.
We modified the detect speed to not send out the exact speed when the participant has hit or is in contact with the balloon. This is because the balloon was moving too fast than it would in the physical reality when force has been applied. We wanted to simulate drag force and give our balloon some weight by only using 30% of the speed which the participant hits the balloon at. The last object contains a multiplication object that multiplies the incoming speed by 0.30. Essentially, the concept and algorithm behind this implementation is:

 F = ma


(2)  Hitting the Balloon to hard - If the participant hits the balloon to hard, the balloon would pop. There were two factors that caused the balloon to pop. If collision has occurred (participant has hit the balloon) and if the speed of collision is too hard. We simulated the balloon popping by making the image of the balloon disappear for 2 seconds before returning back on screen.

Figure 2. Detect Collision when colour overlaps the balloon image modified from [bounce].maxpat from Greg Corness.
The first step is to detect if a collision has occurred. If a collision has occurred send a signal. This signal is sent out to outlet 2.

Figure 3. Detect Speed of collision modified from detect_Speed.maxpat from Greg Corness.

The second step is to detect the speed when there is a collision. The collision signal is sent from the [bounce].maxpat and when the detect_Speed.maxpat receives it, this patch stores the speed of the x and y of the colour movement at the point of collision. Then, it averages the speed and sends this speed out through outlet 3.

Figure 4. Displaying the balloon off screen modified from [movingDigitalobject1].maxpat from Greg Corness. 

The third step involves checking if the participant has hit the balloon too hard. This was simulated by creating an if statement and hard coding a value indicating a hard (very fast) speed  that would result in the balloon popping and going off screen. The if statement checks if the collision speed is greater than the hard coded fast speed, then sends a signal to a switch object to stop displaying the balloon image. However, we wanted the balloon to appear again so our participant can interact with the balloon again. We used a delay statement that changes the switch gate and makes the balloon appear again after 2 seconds.

Pseudocode:
  1. If  color track overlaps balloon image then send a collision signal (1 or -1).
  2. If collision signal is true then capture the speed at the point of collision.
  3. Calculate the average x and y colour track speed at the point of collision.
  4.  If speed at the point of collision is greater than a threshold value then send a signal to the switch object.
  5. If the switch object receives a signal send 1 to switch gate to make balloon image disappear.
  6. Wait 2 seconds before switching back to original gate displaying the balloon image on screen again.


No comments:

Post a Comment