ColladaDance
[music by David Guetta - Love is Gone]
Just a first step to a real dancer.
It works this way: First I load and parse a DAE object (thanks Tim Knip).
In the process, I keep track of the model and each target of the morpher. In this case I have 4 targets Blend left/right and twist left/right.
Then I start a sound.
each Spectrum Time I analyze the spectrum value and tween the new set of values generating the morphing animation in a Tween time.
In these few lines of pseudocode you can see how morphing works
for each model vertex
xVerts = 0; yVerts = 0; zVerts = 0;
for each morpher {
xVerts += morpherValue * morpherTopValue * (morpher.vertex.x - model.vertex.x);
yVerts += morpherValue * morpherTopValue * (morpher.vertex.y - model.vertex.y);
zVerts += morpherValue * morpherTopValue * (morpher.vertex.z - model.vertex.z);
}
geometry.vertex.x = model.vertex.x + xVerts;
geometry.vertex.y = model.vertex.y + yVerts;
geometry.vertex.z = model.vertex.z + zVerts;
}
"MorpherTopValue" refers to the value you set with the slider. While "MorpherValue" is the one coming from the spectrum.
Just feel free to play with the sliders. In addition, you have a combo to set the kind of easing...
|