示例#1
0
    private bool ConnectClothAnim(Garment garment)
    {
        try
        {
            dynamic           g         = garment;
            Vixen.Model       clothmesh = garment.ClothMesh;
            Vixen.SharedWorld world     = Vixen.SharedWorld.Get();
            dynamic           d         = avatarCanvas.ConfigOpts;

            if (d.timeinc != null)
            {
                _timeinc = (float)Double.Parse(d.timeinc);
            }
            if (clothmesh == null)
            {
                return(false);
            }
            if (_clothAnim == null)
            {
                _clothAnim = new MagicMirror.Viewer.ClothRecorder(_timeinc);
            }
            else
            {
                _clothAnim.Clear();
            }
            _clothAnim.BaseName = g.Name;
            world.SuspendScene();
            _clothAnim.AnimRoot = null;
            _clothAnim.MeshRoot = clothmesh;
            _clothAnim.AnimRoot.PutAfter(Vixen.Physics.Get());
            world.ResumeScene();
            return(true);
        }
        catch (Exception ex)
        {
            Vixen.SharedWorld.LogError(ex.Message);
        }
        return(false);
    }