• 大小: 11.15MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-22
  • 语言: 其他
  • 标签: Cardboard  Unity  

资源简介

Cardboard SDK for Unity and Demo 虚拟现实眼镜开发(纸盒应用)谷歌官方SDk 详见:https://developers.google.com/cardboard/overview

资源截图

代码片段和文件信息

// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License Version 2.0 (the “License“);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing software
// distributed under the License is distributed on an “AS IS“ BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Collider))]
public class Teleport : MonoBehaviour {
  private Vector3 startingPosition;

  void Start() {
    startingPosition = transform.localPosition;
    SetGazedAt(false);
  }

  public void SetGazedAt(bool gazedAt) {
    GetComponent().material.color = gazedAt ? Color.green : Color.red;
  }

  public void Reset() {
    transform.localPosition = startingPosition;
  }

  public void ToggleVRMode() {
    Cardboard.SDK.VRModeEnabled = !Cardboard.SDK.VRModeEnabled;
  }

  public void TeleportRandomly() {
    Vector3 direction = Random.onUnitSphere;
    direction.y = Mathf.Clamp(direction.y 0.5f 1f);
    float distance = 2 * Random.value + 1.5f;
    transform.localPosition = direction * distance;
  }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-28 08:15  cardboard-unity-master\
     文件        4114  2015-05-28 08:15  cardboard-unity-master\CHANGELOG
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\
     文件       71490  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\DemoScene.unity
     文件        1769  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\GazePointer.mat
     文件         738  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\GroundPlane.mat
     文件        3474  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\GroundPlane.png
     文件        1408  2015-05-28 08:15  cardboard-unity-master\Cardboard\DemoScene\Teleport.cs
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Editor\
     文件        5355  2015-05-28 08:15  cardboard-unity-master\Cardboard\Editor\CardboardEditor.cs
     文件        4077  2015-05-28 08:15  cardboard-unity-master\Cardboard\Editor\StereoControllerEditor.cs
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\DemoScene\
     文件       14724  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\DemoScene\CardboardPointer.png
     文件       54073  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\DemoScene\DemoScene.unity
     文件        1576  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\DemoScene\TeleportLegacyUI.cs
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Prefabs\
     文件        4253  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Prefabs\CardboardGUI.prefab
     文件       10434  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Prefabs\CardboardMain.prefab
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Resources\
     文件         948  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Resources\GUIScreen.shader
     文件        1334  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\Resources\SkyboxMesh.shader
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\
     文件        6836  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\CardboardAndroidDevice.cs
     文件        5449  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\CardboardOnGUI.cs
     文件        4303  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\CardboardOnGUIMouse.cs
     文件        3086  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\CardboardOnGUIWindow.cs
     文件        7507  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\SkyboxMesh.cs
     文件        1605  2015-05-28 08:15  cardboard-unity-master\Cardboard\Legacy\scripts\StereoLensFlare.cs
     目录           0  2015-05-28 08:15  cardboard-unity-master\Cardboard\Prefabs\
............此处省略26个文件信息

评论

共有 条评论