예제 #1
0
    public void refreshShape()
    {
        Mesh m = GetComponent <MeshFilter>().mesh;

        Vector3[] v     = m.vertices;
        int[]     f     = m.triangles;
        float[]   shape = new float[f.Length * 3];

        for (int i = 0; i < f.Length; i++)
        {
            Vector3 vert = v[f[i]];
            vert.Scale(transform.localScale);
            vert.Scale(device_scale);
//				vert = transform.localRotation*vert;

            shape[i * 3]     = vert.x;
            shape[i * 3 + 1] = vert.y;
            shape[i * 3 + 2] = vert.z;
        }
        Vector3 localPosition = transform.localPosition;

        localPosition.Scale(device_scale);

        FalconUnity.sendDynamicShape(bodyId, shape, f.Length / 3, mass, k, localPosition, transform.localRotation, linearFactors, angularFactors, friction);
        FalconUnity.addSpringToShape(bodyId, springId, max_force, dampingFactor, springPos, springOrientation, posConstraintLower, posConstraintUpper, orientConstraintCCW, orientConstraintCW, directionality);
    }