{"id":9581,"date":"2021-02-26T10:00:36","date_gmt":"2021-02-26T01:00:36","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=9581"},"modified":"2021-02-25T22:48:28","modified_gmt":"2021-02-25T13:48:28","slug":"htc-vive-unity-%e3%83%ac%e3%83%bc%e3%82%b6%e3%83%bc%e3%83%9d%e3%82%a4%e3%83%b3%e3%82%bf%e3%83%bc%e3%81%ae%e5%ae%9f%e8%a3%85%e6%96%b9%e6%b3%95-4","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/9581","title":{"rendered":"[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (4)"},"content":{"rendered":"\n<p>HTC VIVE\u7528VR\u30a2\u30d7\u30ea\u958b\u767a\u3067Unity\u3092\u4f7f\u7528\u3057\u3066\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br> \u672c\u8a18\u4e8b\u306f\u524d\u56de\u306e\u300c<a rel=\"noreferrer noopener\" aria-label=\"[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (3) (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\" href=\"\/appnews\/archives\/9536\" target=\"_blank\">[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (3)<\/a>\u300d\u306e\u7d9a\u304d\u3067\u3059\u3002<br> \u4eca\u56de\u306f\u3001\u524d\u56de\u8ffd\u52a0\u3057\u305f\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306b\u885d\u7a81\u5224\u5b9a\u51e6\u7406\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h4>\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306b\u885d\u7a81\u5224\u5b9a\u51e6\u7406\u3092\u8ffd\u52a0\u3059\u308b<\/h4>\n\n\n\n<p>\u5f53\u305f\u308a\u5224\u5b9a\u306e\u52d5\u4f5c\u78ba\u8a8d\u7528\u306b3D\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u300cTestCube\u300d\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"223\" height=\"202\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/18.png\" alt=\"\" class=\"wp-image-9584\"\/><\/figure>\n\n\n\n<p>\u5f53\u305f\u308a\u5224\u5b9a\u306e\u6319\u52d5\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3088\u3046\u306b\u60f3\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30fb\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304cTestCube\u306b\u89e6\u308c\u305f\u3068\u304dTestCube\u306f\u9752\u8272\u306b\u306a\u308a\u307e\u3059\u3002<br> \u30fb\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304cTestCube\u304b\u3089\u96e2\u308c\u305f\u3068\u304dTestCube\u306f\u9ec4\u8272\u306b\u306a\u308a\u307e\u3059\u3002<br> \u30fb\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304cTestCube\u306b\u7126\u70b9\u3092\u3042\u308f\u305b\u3066\u30c8\u30ea\u30ac\u30fc\u3092\u3072\u3044\u305f\u3068\u304dTestCube\u306f\u8d64\u8272\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4>\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u885d\u7a81\u5224\u5b9a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u4f8b<\/h4>\n\n\n\n<p>\u4e0a\u8a18\u306e\u6319\u52d5\u306b\u306a\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u885d\u7a81\u5224\u5b9a\u51e6\u7406\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br> Class\u540d\u306f\u4eee\u306b\u300cLaserPointerHandler\u300d\u3068\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u540d\u79f0\u306f\u4efb\u610f\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.EventSystems;\nusing UnityEngine.UI;\nusing Valve.VR.Extras;\n\npublic class LaserPointerHandler : MonoBehaviour\n{\n    \/\/\u53f3\u624b\u7528\n    public SteamVR_LaserPointer laserPointer;\n    \/\/\u5de6\u624b\u7528\n    public SteamVR_LaserPointer laserPointer2;\n\n    void Awake()\n    {\n        laserPointer.PointerIn += PointerInside;\n        laserPointer.PointerOut += PointerOutside;\n        laserPointer.PointerClick += PointerClick;\n        laserPointer2.PointerIn += PointerInside;\n        laserPointer2.PointerOut += PointerOutside;\n        laserPointer2.PointerClick += PointerClick;\n    }\n\n    \/\/\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u3092target\u306b\u7126\u70b9\u3092\u3042\u308f\u305b\u3066\u30c8\u30ea\u30ac\u30fc\u3092\u3072\u3044\u305f\u3068\u304d\n    public void PointerClick(object sender, PointerEventArgs e)\n    {\n        \/\/3D\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u300cTestCube\u300d\u306e\u8272\u3092\u8d64\u8272\u306b\u5909\u66f4\u3059\u308b\n        if (e.target.name == \"TestCube\")\n        {\n            GameObject testcube = GameObject.Find(\"TestCube\");\n            testcube.GetComponent&lt;Renderer>().material.color = Color.red;\n        }\n    }\n\n    \/\/\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304ctarget\u306b\u89e6\u308c\u305f\u3068\u304d\n    public void PointerInside(object sender, PointerEventArgs e)\n    {\n        \/\/3D\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u300cTestCube\u300d\u306e\u8272\u3092\u9752\u8272\u306b\u5909\u66f4\u3059\u308b\n        if (e.target.name == \"TestCube\")\n        {\n            GameObject testcube = GameObject.Find(\"TestCube\");\n            testcube.GetComponent&lt;Renderer>().material.color = Color.blue;\n        }\n    }\n\n    \/\/\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304ctarget\u304b\u3089\u96e2\u308c\u305f\u3068\u304d\n    public void PointerOutside(object sender, PointerEventArgs e)\n    {\n        \/\/3D\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u300cTestCube\u300d\u306e\u8272\u3092\u9ec4\u8272\u306b\u5909\u66f4\u3059\u308b\n        if (e.target.name == \"TestCube\")\n        {\n            GameObject testcube = GameObject.Find(\"TestCube\");\n            testcube.GetComponent&lt;Renderer>().material.color = Color.yellow;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7a7a\u306e\u30b2\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u7b49\u306b\u30a2\u30bf\u30c3\u30c1\u3057\u307e\u3059\u3002<br> public\u3067\u8a2d\u5b9a\u3057\u305f laserPointer, laserPointer2 \u306b\u306f\u53f3\u624b\/\u5de6\u624b\u305d\u308c\u305e\u308c\u306e\u300cSteamVR_LaserPointer\u300d\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30a2\u30bf\u30c3\u30c1\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"280\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/14-1024x280.png\" alt=\"\" class=\"wp-image-9588\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/14-1024x280.png 1024w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/14.png 1146w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4>\u52d5\u4f5c\u78ba\u8a8d<\/h4>\n\n\n\n<p>\u300cPlay\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u52d5\u4f5c\u306e\u78ba\u8a8d\u3092\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304cTestCube\u306b\u89e6\u308c\u305f\u3068\u304dTestCube\u306f\u9752\u8272\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"744\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/16-1024x744.png\" alt=\"\" class=\"wp-image-9591\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/16-1024x744.png 1024w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/16.png 1193w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u304cTestCube\u304b\u3089\u96e2\u308c\u305f\u3068\u304dTestCube\u306f\u9ec4\u8272\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"860\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/15-1024x860.png\" alt=\"\" class=\"wp-image-9592\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/15-1024x860.png 1024w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/15.png 1077w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u3092TestCube\u306b\u7126\u70b9\u3092\u3042\u308f\u305b\u3066\u30c8\u30ea\u30ac\u30fc\u3092\u3072\u3044\u305f\u3068\u304d\u3001\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5149\u7dda\u304c\u7dd1\u8272\u306b\u306a\u308aTestCube\u306f\u8d64\u8272\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"776\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/17-1024x776.png\" alt=\"\" class=\"wp-image-9593\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/17-1024x776.png 1024w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/02\/17.png 1157w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4ee5\u4e0a\u306e\u52d5\u4f5c\u306e\u78ba\u8a8d\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u91d1\u66dc\u65e5\u62c5\u5f53\uff1anishida<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/9581\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/9581\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (4)\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/9581\" data-text=\"[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (4)\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/9581\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/9581\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>HTC VIVE\u7528VR\u30a2\u30d7\u30ea\u958b\u767a\u3067Unity\u3092\u4f7f\u7528\u3057\u3066\u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u672c\u8a18\u4e8b\u306f\u524d\u56de\u306e\u300c[HTC VIVE + Unity] \u30ec\u30fc\u30b6\u30fc\u30dd\u30a4\u30f3\u30bf\u30fc\u306e\u5b9f\u88c5\u65b9\u6cd5 (3)\u300d\u306e\u7d9a\u304d\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001\u524d\u56de [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[84,109],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/9581"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=9581"}],"version-history":[{"count":6,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/9581\/revisions"}],"predecessor-version":[{"id":9598,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/9581\/revisions\/9598"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=9581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=9581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=9581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}