コード例 #1
0
    private void Update()
    {
        //Rotate the controller object slightly.
        if (rotationAxis.sqrMagnitude > 0f)
        {
            float degrees = 360f / secondsPerRevolution * Time.deltaTime;
            skin.transform.Rotate(rotationAxis, degrees, Space.World);

            Mesh mesh = skin.GetFirstControllerMesh();
            if (mesh)
            {
                Vector3 center = mesh.bounds.center;
                skin.transform.localPosition = -(skin.transform.localRotation * center);
            }
        }
    }
コード例 #2
0
    public void Update()
    {
        //Draw the primary hand controller on the inside.
        SetControllerSkin skin = PrimaryHandSwitcher.primaryHandObject.GetComponentInChildren <SetControllerSkin>();

        if (skin != null)
        {
            Mesh mesh = skin.GetFirstControllerMesh();
            if (mesh)
            {
                Quaternion drawrot = Quaternion.LookRotation(zedManager.transform.position - transform.position, Vector3.up);
                Vector3    drawpos = transform.position - drawrot * mesh.bounds.center;


                controllerDrawMat.SetPass(0);
                Graphics.DrawMesh(mesh, drawpos, drawrot, controllerDrawMat, CameraAnchor.HIDE_FROM_ZED_LAYER);
            }
        }
    }