PDA

View Full Version : Determine movement on X/Y parallel to the camera


jj80
10-28-2005, 06:44 AM
Holla,

I have a little big problem here and was wondering if someone could help out.
I am trying to determine the fastest moving vertixes within a scene. So far so good, not too hard. The only thing is I'd like to know how fast they're moving on X/Y space parallel to the camera, as opposed to XYZ worldspace.

that's what I have so far (worldspace):

global proc magVector( int $frame ){
string $sel[] = `ls -sl -fl`;
for($vtx in $sel){
currentTime $frame;
float $pos1[] = `pointPosition $vtx`;
currentTime ($frame + 1);
float $pos2[] = `pointPosition $vtx`;

float $dist[] = { ($pos2[0] - $pos1[0]), ($pos2[1] - $pos1[1]), ($pos2[2] - $pos1[2]) };
float $mag = mag($dist);

print ("Mag for " + $vtx + " at frame " + $f + " = " + $mag);
}
}

Any hints would be highly appreciated !

thanks,

Jens

Bonedaddy
10-28-2005, 07:44 AM
Well, the thing to do is figure out where they are in screenspace, and store variables to determine where they are from frame to frame, and whatnot. I would dissect the Maya->Shake Locator script on highend3d, because it does calculations based on screenspace.

http://highend3d.com/maya/downloads/mel_scripts/utility_external/misc/1680.html

wrend
10-28-2005, 07:44 AM
tranform the points into camera space. that is, use the camera's matrix to multiply your points. havea look at vetorProduct node to get you started.

jj80
10-30-2005, 10:06 PM
thanks for your help guys, I am playing with the camera matrix right now. Will let you know what happening...

cheers,

Jens

jj80
10-31-2005, 10:05 PM
I managed to use the matrix from the shake exporter script and it all works well now, thanks again !

CGTalk Moderation
10-31-2005, 10:05 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.