Search Unity

Blending animations issue.

Discussion in 'Scripting' started by mongoose54, Dec 31, 2013.

  1. mongoose54

    mongoose54

    Joined:
    Sep 19, 2012
    Posts:
    5
    So I have 2 blendshape animations embedded to my object (a plane mesh exported from Maya) and I want to interpolate between them. Each animation takes values between 0 to 100. So the overall animation is 0 to 100. The animations deform the mesh.

    Depending on where the user pressed I want the animations to be interpolated. Here is my JS script for blending the animations:

    Code (csharp):
    1.      object.SetBlendShapeWeight(0,hit.point.z*currentLocation);
    2.      object.SetBlendShapeWeight(1,(1.00-hit.point.z)*currentLocation);
    where hit.point.z is the point on the z axis the user pressed on. It takes values between 0 to 1. Also currentLocation is the overall animation location (0 to 100).

    So far so good right? The problem is that when currentLocation >70 and hit.point.z =0.5 then the animated is deformed pretty ugly. The reason is that by adding/interpolating the 2 animations above it deforms the object more than it should be. From my understanding a real blendshape should be like:
    Code (csharp):
    1. hit.point.z * object.SetBlendShapeWeight(0,currentLocation)
    and
    Code (csharp):
    1. (1.00-hit.point.z)*object.SetBlendShapeWeight(1,currentLocation)
    . That would be a true interpolation. In any case I was wondering if you have any ideas on how to tackle this issue. I would really appreciate it.
     
  2. mongoose54

    mongoose54

    Joined:
    Sep 19, 2012
    Posts:
    5
    Any help anyone?