View Full Version : convert particle collisions U and V to 3D coordinates

 misterwolfy11 November 2010, 01:07 PMI have a collision event that produces collision U and V output. float \$colU = particleShape1.collisionU; float \$colV = particleShape1.collisionV; I get results like: collisions in u: 0.9518819253 collisions in v: 0.6064704928 collisions in u: 0.9414537137 collisions in v: 0.6129580163 collisions in u: 0.619097031 collisions in v: 0.7295783004 How do I convert these UV coordinates to spacial coordinates? I want Z X so that I can place objects at the points of collision. the collision is between a 2x2 plane emitting particles and a 2x2 plane that they are colliding with. Thanks for reading!!
misterwolfy
11 November 2010, 01:11 PM
My solutions did not wor so far, maybe there is a way?

float \$colU = particleShape1.collisionU;
float \$colV = particleShape1.collisionV;

if (\$colU > 0) {
particleShape1.lifespanPP=0;
print ( "collisions in u:" + \$colU + "collisions in v:" + \$colV+"\n");
setAttr "locator.translateX" (\$colU*20);
setAttr "locator.translateZ" (\$colV*10);
}

Jacobborsting
11 November 2010, 03:27 PM

misterwolfy
11 November 2010, 03:40 PM
Sure, but I already figured it out, with some help form a cc user named Nowayfra. (http://www.creativecrash.com/forums/dynamics-amp-effects/topics/interpreting-the-position-of-a-particle-collision--2/posts/306216)

Here is the file (http://www.mrwolfy.com/uploads/particleCollisionTest.mb.zip), before I fixed it. Paste (replace) the code below into the only expression in the scene to repair. I commented the line that was giving me trouble below.

float \$colU = particleShape1.collisionU;
float \$colV = particleShape1.collisionV;
int \$time = `currentTime -q`;

if (\$colU > 0) {
particleShape1.lifespanPP=0;
setAttr "loc.translateX" (\$colU*10);
//this is the line that was giving me trouble, values needed to be inverted.
setAttr "loc.translateZ" ((1 - \$colV) * 10);
}

Thanks

CGTalk Moderation
11 November 2010, 03:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1