示例#1
0
    private void Update()
    {
        HoloToolkit.Unity.SpatialMapping.OrientedBoundingBox obb = OBBMeshIntersection.CreateWorldSpaceOBB(GetComponent <BoxCollider>());
        List <int> intersecting = OBBMeshIntersection.FindTriangles(obb, m_triangleMesh.vertices, m_triangleMesh.GetTriangles(0), m_triangleXform);

        GetComponent <Renderer>().material.color = intersecting.Count > 0 ? Color.red : Color.green;
    }
示例#2
0
    private void CreateBulletHole(Vector3 position, Vector3 normal)
    {
        GameObject bulletHole = Instantiate(m_bulletHolePrefab, position, Quaternion.LookRotation(normal)) as GameObject;

        bulletHole.transform.parent = this.transform;
        OrientedBoundingBox obb = OBBMeshIntersection.CreateWorldSpaceOBB(bulletHole.GetComponent <BoxCollider>());

        SurfacePlaneDeformationManager.Instance.Embed(bulletHole, obb, position, () => { Debug.Log("Embed complete"); }, true);
    }
    private void CreateBulletHole(Vector3 position, Vector3 normal, SurfacePlane plane)
    {
        GameObject bulletHole = Instantiate(m_bulletHolePrefab, position, Quaternion.LookRotation(normal)) as GameObject;

        bulletHole.AddComponent <WorldAnchor>(); // does this do anything?
        bulletHole.transform.parent = this.transform;
        OrientedBoundingBox obb = OBBMeshIntersection.CreateWorldSpaceOBB(bulletHole.GetComponent <BoxCollider>());

        SurfacePlaneDeformationManager.Instance.Embed(bulletHole, obb, plane);
    }
示例#4
0
    // SpatialUnderstanding case
    public void CreateBulletHole(Vector3 position, Vector3 normal)
    {
        GameObject bulletHole = Instantiate(bulletHolePrefab, position + normal * .005f, Quaternion.LookRotation(normal)) as GameObject;

        bulletHole.transform.parent = this.transform;
        SurfacePlaneDeformationManager.Instance.Embed(bulletHole, OBBMeshIntersection.CreateWorldSpaceOBB(bulletHole.GetComponent <BoxCollider>()), bulletHole.transform.position);
        //TODO: logic for objects to self destruct after not being gazed at for long enough?
        m_bulletHoles.Enqueue(bulletHole);
        while (m_bulletHoles.Count > maxBulletHoles)
        {
            GameObject oldBulletHole = m_bulletHoles.Dequeue();
            if (oldBulletHole) // if hasn't destroyed itself already
            {
                Destroy(oldBulletHole);
            }
        }
    }
示例#5
0
    void Start()
    {
        BoxCollider obb  = obbParent.GetComponent <BoxCollider>();
        Mesh        mesh = meshParent.GetComponent <MeshFilter>().sharedMesh;

        Debug.Log("OBB-Mesh Intersection Result: " + (OBBMeshIntersection.FindTriangles(OBBMeshIntersection.CreateWorldSpaceOBB(obb), mesh.vertices, mesh.GetTriangles(0), meshParent.transform).Count > 0));
    }