Пример #1
0
    public void UpdateMesh()
    {
        tube.SetPointsAndRotations(rope.JointPositions, rope.GetRotations(rope.JointPositions));
        tube.SetEdgeCount(crossSegments);

        float[] rads = new float[rope.JointPositions.Length];
        for (int i = 0; i < rads.Length; i++)
        {
            rads[i] = curve.Evaluate(i * (1f / rads.Length));
        }

        tube.SetRadiuses(rads);
        tube.Update();

        gameObject.renderer.sharedMaterial.mainTextureScale = new Vector2(rope.Joints.Count * textureTiling, 1);
    }
Пример #2
0
    public void GenerateMesh()
    {
        tube.SetPointsAndRotations(rope.JointPositions, rope.GetRotations(rope.JointPositions));
        tube.SetEdgeCount(crossSegments);

        float[] rads = new float[rope.JointPositions.Length];
        for (int i = 0; i < rads.Length; i++)
        {
            rads[i] = curve.Evaluate(i * (1f / rads.Length));
        }
        tube.SetRadiuses(rads);

        tube.Update();
        mFilter.mesh = tube.mesh;
    }