コード例 #1
0
    public async void Raycast(Vector3 origin, Vector3 direction)
    {
        var remoteEntity = await RemoteRayCast(origin, direction);

        if (focusedModel != null)
        {
            if (focusedModel.Entity == remoteEntity)
            {
                // picked the same object as before
                return;
            }

            ClearFocus();
        }

        if (remoteEntity == null)
        {
            // picked no object at all
            return;
        }

        // get the instance of a Unity GameObject for the ARR entity
        var entityGO = remoteEntity.GetOrCreateGameObject(UnityCreationMode.DoNotCreateUnityComponents);

        // ensure the game object has the RemoteModelEntity component
        focusedModel = entityGO.GetComponent <RemoteModelEntity>();
        if (focusedModel == null)
        {
            focusedModel = entityGO.AddComponent <RemoteModelEntity>();
        }

        focusedModel.SetFocus(true);
    }
コード例 #2
0
 private void ClearFocus()
 {
     focusedModel.SetFocus(false);
     CleanHierarchy(focusedModel.gameObject);
     focusedModel = null;
 }