## Shapes reacting against the movement tracked by kinect?

Apr 21, 2012 at 4:43pm

# Shapes reacting against the movement tracked by kinect?

Hello,
I’m trying to make a moving graphic interacts with body movement tracked by Kinect.
I could make a group of shapes follows the movement but I cant make those shapes react against the movement. For example, 12 triangles bounced buy hand stroking.

I assumed there are 3 stages of this operation.
1. calculate distances between objects and body part.
2. If the distances are less then 0.2
3. trigger the reaction

there are several problems to solve.
I managed to calculated the distances from objects to body parts (not perfectly correct though)
but the rest of the part I have no idea how I could do it.
I have been experimenting but still I couldn’t figure it out.

###### Attachments:
1. val5.maxpat
#63125
Apr 22, 2012 at 10:40am

HI,

I’m working with slidin. The question is how to detect the collision between a line and a triangle. I found the following program (http://gamedev.stackexchange.com/questions/5585/line-triangle-intersection-last-bits) that I translated into Max. It’s getting complicated, I hope someone can help !!

// Find Triangle Normal
Normal.cross( P2 – P1, P3 – P1 );
Normal.normalize(); // not really needed? Vector3f does this with cross.

// Find distance from LP1 and LP2 to the plane defined by the triangle
float Dist1 = (R1-P1).dot( Normal );
float Dist2 = (R2-P1).dot( Normal );

if ( (Dist1 * Dist2) >= 0.0f) {
return false;
} // line doesn’t cross the triangle.

if ( Dist1 == Dist2) {
return false;
} // line and plane are parallel

In order to do the dot.product, cross.product, I used Zachary’s abstractions (http://www.zacharyseldess.com/z.abstractions.html).

– Pasted Max Patch, click to expand. –
#227810

You must be logged in to reply to this topic.