FORUMS: list search recent posts

Calling on Trax Clips from Expression Editor

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Jana Johnson
Calling on Trax Clips from Expression Editor
on Sep 28, 2009 at 9:48:02 pm

I've got a referenced character with a character set and clips that has been instanced to a particle grid. I'm trying to get a certain clip to play when an object (psphere1) gets within it's range. However I keep getting this error, and I have no idea how to fix it. I've tried looking at Maya's mel reference, but it isn't helping. Hopefully someone has an idea of how to fix this.The error I get is:

// Error: Must select a single character or a clip library. //

Here is the runtime before dynamics expression:

float $threshold = 4;
float $attentionDist = 7;
float $turningDistance = 0.5;
float $power = 1.5;
float $extraRotation = 90;
string $walk_ani;
string $wait_ani;
string $character = "Scientist_v1:Scientist1";
string $clips[] = `clip -pasteInstance -aa -sc 1 -startTime 122 -mapMethod byAttrName ($character)`;

$walk_ani = "Scientist1:walk1Source";

float $factor;
float $factorVectorLength;
//int $currentFrame = `currentTime -query`;
$posInit = particleShape1.userVector2PP;
$pos = particleShape1.position;
$posTarget = <> - <>;

vector $dist = $posTarget - $pos;

vector $vectFromOrigin = $pos - $posInit;
float $distFromOrigin = sqrt($vectFromOrigin.x*$vectFromOrigin.x + $vectFromOrigin.y*$vectFromOrigin.y + $vectFromOrigin.z*$vectFromOrigin.z);

$distLength = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
vector $factorVector;
$signal = -sign($dist.z);

particleShape1.userScalar1PP = $signal*90 + 90*sin(25*$posInit.z*$posInit.x);

vector $targetNorm = unit($posInit - $posTarget);



$factorVector = $posInit - $posTarget - $turningDistance*$targetNorm;


$factorVectorLength = sqrt($factorVector.x*$factorVector.x + $factorVector.y*$factorVector.y + $factorVector.z*$factorVector.z);
$factor = (pow($factorVectorLength/$threshold , $power*(1-$factorVectorLength/$threshold))) - 1;

if (abs($factorVectorLength)<$turningDistance)
{
}


if (abs($factorVectorLength)<$threshold )
{
particleShape1.position = $posInit + $factor*$factorVector;
float $aimedRotation = $signal*rad_to_deg(angle($dist, <<1,0,0>>));
particleShape1.userVector1PP = <<0,$aimedRotation + $extraRotation ,0>>;
if (particleShape1.userScalar3PP != 3)
{
particleShape1.userScalar3PP = 3;
///Action///
particleShape1.position += <<0,0.2,0>>;
clip -copy -n "$walk_ani";
string $clips[];


}
}

if (abs($factorVectorLength)>$threshold )
{
particleShape1.position = $posInit ;
}

if (abs($factorVectorLength >$threshold && $attentionDist > $factorVectorLength ))
{
float $aimedRotation = $signal*rad_to_deg(angle($dist, <<1,0,0>>));
float $originalRotation = particleShape1.userScalar1PP;
float $currentRotation = $aimedRotation + ($originalRotation - $aimedRotation)*($factorVectorLength - $threshold)/($attentionDist - $threshold);
particleShape1.userVector1PP = <<0,$currentRotation + $extraRotation,0>>;
if (particleShape1.userScalar3PP != 2)
{
particleShape1.userScalar3PP = 2;
///Action///
particleShape1.position += <<0,0.2,0>>;
}
}

if (abs($factorVectorLength > $attentionDist ))
{
particleShape1.userVector1PP = <<0,particleShape1.userScalar1PP + $extraRotation ,0>>;
if (particleShape1.userScalar3PP != 1)
{
particleShape1.userScalar3PP = 1;
///Action///
particleShape1.position += <<0,0.2,0>>;
}

}


Return to posts index

Jana Johnson
Re: Calling on Trax Clips from Expression Editor
on Sep 29, 2009 at 9:48:28 pm

Ok, so I think I'm on to something:
///////////////////
clip -copy -n "walkStartSource" "Scientist_v1:Scientist1";
clip -pi -aa -sc 1 -s 122 -n "walkStartSource" -nn "walkStartSource2" "Scientist_v1:Scientist1";
///////////////////
Does anyone know how to get it so that everytime I call upon "walkStartSource" it renames it numerically everytime? So that if I ran it again I'd get "walkStartSource3"


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]