コード例 #1
0
 public void MeshObjectUpdate(MeshObjectUpdateStatus status)
 {
     if (status != MeshObjectUpdateStatus.IN)
     {
         fishvelocity = 5 * RandomWalkVelocity(objectsWorld, transform.position);
         Quaternion q = transform.rotation;
         Vector3    v = fishvelocity;
         v.y = 0;
         v   = Vector3.Normalize(v);
         float angle = v.z > 0 ? Mathf.Acos(v.x) : 2 * Mathf.PI - Mathf.Acos(v.x);
         //q.y = 270f - 360f * angle;
         q.eulerAngles      = new Vector3(90, 360f - 360f * angle / (2 * Mathf.PI), 0);
         transform.rotation = q;
     }
 }
コード例 #2
0
    // Update is called once per frame
    public override void Update()
    {
        numobjects = numverts = numtris = nummats = numtrimats = 0;
        foreach (IMeshObject o in voxObjects)
        {
            GameObject go = o.MeshObjectGetGameObject();
            // if o is not active, skip it
            if (!go.activeSelf)
            {
                continue;
            }
            MeshObjectUpdateStatus status = MeshObjectUpdateStatus.IN;
            // if o is completely out of the box, skip it
            Renderer r = go.GetComponent <Renderer>();
            if (!worldBounds.Intersects(r.bounds))
            {
                status = MeshObjectUpdateStatus.OUT;
            }
            else
            {
                status = worldBounds.Contains(go.transform.position) ?
                         MeshObjectUpdateStatus.IN : MeshObjectUpdateStatus.INTERSECT;
            }

            if (o.MeshObjectListener() != null)
            {
                o.MeshObjectListener().MeshObjectUpdate(status);
            }

            if (status != MeshObjectUpdateStatus.OUT)
            {
                numobjects++;
                vox(o);
            }
        }
        voxel(numobjects, numverts, numtris, nummats);
        UpdateLED();
    }
コード例 #3
0
 public void MeshObjectUpdate(MeshObjectUpdateStatus s)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public void MeshObjectUpdate(MeshObjectUpdateStatus s)
 {
 }