{"id":490,"date":"2012-03-01T01:45:57","date_gmt":"2012-02-29T16:45:57","guid":{"rendered":"http:\/\/nyatla.jp\/nyartoolkit\/wp\/?p=490"},"modified":"2012-11-24T13:02:56","modified_gmt":"2012-11-24T04:02:56","slug":"nyartoolkit4-0-0a-for-unity3d","status":"publish","type":"post","link":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/?p=490","title":{"rendered":"NyARToolkit4.0.0a for Unity3D"},"content":{"rendered":"<p>Unity 3.5\u304b\u3089\u3001Web\u30ab\u30e1\u30e9\u304c\u624b\u8efd\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306d\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001NyARToolkitCS\u3092Unity\u306b\u5bfe\u5fdc\u3055\u305b\u307e\u3057\u305f\u3002\u6b63\u5f0f\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u307e\u3067\u306b\u306f\u3082\u3046\u5c11\u3057\u6642\u9593\u304c\u304b\u304b\u308b\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u03b1\u7248\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-494\" title=\"\u7121\u984c\" src=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5-300x215.png\" alt=\"\" width=\"300\" height=\"215\" srcset=\"https:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5-300x215.png 300w, https:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5.png 807w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>NyARToolkitCS for Unity3D\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30de\u30fc\u30ab\u30d9\u30fc\u30b9AR\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30b7\u30f3\u30d7\u30eb\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u7279\u5fb4<\/h2>\n<ul>\n<li>NyARToolkit\/4.0\u306eMarkerSystemAPI\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u8907\u6570\u30de\u30fc\u30ab\/Id\u30de\u30fc\u30ab\u306e\u540c\u6642\u8907\u6570\u4f7f\u7528\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<li>\u4ed6\u30de\u30fc\u30ab\u30d9\u30fc\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u7570\u306a\u308a\u3001\u5168\u3066C#\u3067\u5b9f\u88c5\u3057\u3066\u3042\u308a\u307e\u3059\u3002WebcamTexture\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u5168\u3066\u306eUnity\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067(\u591a\u5206)\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/li>\n<li>ARToolKitV4Pro\u3068\u306e\u7d71\u5408\u304c\u53ef\u80fd\u3067\u3059\u3002\uff08\u4e88\u5b9a\uff09<\/li>\n<\/ul>\n<h2>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h2>\n<p style=\"padding-left: 30px;\">NyARToolkit for Unity3D\u306e\u03b1\u30ea\u30ea\u30fc\u30b9\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"http:\/\/sourceforge.jp\/projects\/nyartoolkit\/releases\/?package_id=12917\">http:\/\/sourceforge.jp\/projects\/nyartoolkit\/releases\/?package_id=12917<\/a><\/p>\n<h2>Getting started<\/h2>\n<p style=\"padding-left: 30px;\">\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0SimpleLite\u3092\u52d5\u304b\u3059\u307e\u3067\u306e\u624b\u9806\u3067\u3059\u3002<\/p>\n<ol style=\"padding-left: 30px;\">\n<li>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<br \/>\nNyARToolkitCS for Unity\/4.0.0a\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001\u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\u306b\u5c55\u958b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<br \/>\n\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u3063\u3066\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-491\" title=\"\u7121\u984c\" src=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e2-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/li>\n<li>simpleLite\u306e\u30b7\u30fc\u30f3\u3092\u5fa9\u5143\u3057\u307e\u3059\u3002simpleLite\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u73fe\u5728\u306e\u30b7\u30fc\u30f3\u3092\u30bb\u30fc\u30d6\u3059\u308b\u304b\u805e\u3044\u3066\u304f\u308b\u306e\u3067\u3001\u7121\u8996\u3057\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-492\" title=\"\u7121\u984c\" src=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e3-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/li>\n<li>\u30b7\u30fc\u30f3\u304c\u30ed\u30fc\u30c9\u3055\u308c\u305f\u3089\u3001Web\u30ab\u30e1\u30e9\u304c\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3001Play\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-thumbnail wp-image-493 alignnone\" title=\"\u7121\u984c\" src=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e4-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/li>\n<li>Hiro\u30de\u30fc\u30ab\u3092\u64ae\u5f71\u3059\u308b\u3068\u3001\u8d64\u3044\u7acb\u65b9\u4f53\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-494\" title=\"\u7121\u984c\" src=\"http:\/\/nyatla.jp\/nyartoolkit\/wp\/wp-content\/uploads\/0d40a5e4a645fc6b96e767d64ac0878e5-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/li>\n<\/ol>\n<h2><\/h2>\n<h2>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u89e3\u8aac<\/h2>\n<p style=\"padding-left: 60px;\">Unity3D\u3067\u306eNyARToolkit\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001MarkerSystem\u30af\u30e9\u30b9\u3067\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 60px;\">MarkerSystem \u30af\u30e9\u30b9\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30011\u3064\u306eMainCamera\u30011\u3064\u306e\u80cc\u666fPanel\u3001\u30de\u30fc\u30ab\u306e\u59ff\u52e2\u3092\u4fdd\u6301\u3059\u308b Gameobject\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u3001Light\u3084\u3001\u8868\u793a\u7269(\u30b5\u30f3\u30d7\u30eb\u306e\u5834\u5408\u306b\u306fCube)\u3082\u3042\u308b\u3068\u826f\u3044\u306e\u3067\u3001\u305d\u308c\u3089\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 60px;\">MainCamera\u3068\u80cc\u666fPanel\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001Start\u95a2\u6570\u5185\u3067MarkerSystem\u304c\u81ea\u52d5\u3067\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u521d\u671f\u5024\u306f\u9069\u5f53\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<p style=\"padding-left: 60px;\">\u30de\u30fc\u30ab\u306e\u59ff\u52e2\u884c\u5217\u3068\u80cc\u666f\u306e\u66f4\u65b0\u306f\u3001MainCamera\u306b\u5272\u308a\u5f53\u3066\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u304b\u3089\u884c\u3044\u307e\u3059\u3002\u4e00\u5b9a\u5468\u671f\u3067WeCamTexture\u304b\u3089\u72b6\u614b\u3092\u66f4\u65b0\u3067\u304d\u308c\u3070\u3001\u4ed6\u306e\u69cb\u6210\u3092\u3068\u3063\u3066\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nusing UnityEngine;\r\nusing System;\r\nusing System.Collections;\r\nusing jp.nyatla.nyartoolkit.cs.markersystem;\r\nusing jp.nyatla.nyartoolkit.cs.core;\r\nusing NyARUnityUtils;\r\nusing System.IO;\r\n\r\npublic class ARCameraBehaviour : MonoBehaviour\r\n{\r\n  private NyARUnityMarkerSystem _ms;\r\n  private NyARUnityWebCam _ss;\r\n  private int mid;\/\/marker id\r\n  private GameObject _bg_panel;\r\n  void Awake()\r\n  {\r\n    NyARMarkerSystemConfig config = new NyARMarkerSystemConfig(320,240);\r\n    this._ms=new NyARUnityMarkerSystem(config);\r\n    mid=this._ms.addARMarker(&quot;.\/Assets\/Data\/patt.hiro&quot;,16,25,80);\r\n\r\n    \/\/setup unity webcam\r\n    WebCamDevice&#x5B;] devices= WebCamTexture.devices;\r\n    WebCamTexture w;\r\n    if (devices.Length &gt; 0){\r\n      w=new WebCamTexture(320, 240, 15);\r\n      this._ss=new NyARUnityWebCam(w);\r\n      \/\/setup background\r\n      this._bg_panel=GameObject.Find(&quot;Plane&quot;);\r\n      this._bg_panel.renderer.material.mainTexture=w;\r\n      this._ms.setARBackgroundTransform(this._bg_panel.transform);\r\n\r\n      \/\/setup camera projection\r\n      this._ms.setARCameraProjection(this.camera);\r\n\r\n    }else{\r\n      Debug.LogError(&quot;No Webcam.&quot;);\r\n    }\r\n  }\r\n  \/\/ Use this for initialization\r\n  void Start ()\r\n  {\r\n    \/\/start sensor\r\n    this._ss.start();\r\n  }\r\n  \/\/ Update is called once per frame\r\n  void Update ()\r\n  {\r\n    \/\/Update SensourSystem\r\n    this._ss.update();\r\n    \/\/Update marker system by ss\r\n    this._ms.update(this._ss);\r\n    \/\/update Gameobject transform\r\n    if(this._ms.isExistMarker(mid)){\r\n      this._ms.setUnityMarkerTransform(mid,GameObject.Find(&quot;MarkerObject&quot;).transform);\r\n    }else{\r\n      \/\/ hide Game object\r\n      GameObject.Find(&quot;MarkerObject&quot;).transform.localPosition=new Vector3(0,0,-100);\r\n    }\r\n  }\r\n<\/pre>\n<p style=\"padding-left: 60px;\">\u8868\u793a\u7269\u306fGameobject\uff08\u30b5\u30f3\u30d7\u30eb\u3067\u306fMarkerObject\uff09\u306e\u5b50\u3068\u3057\u3066\u914d\u7f6e\u3057\u307e\u3059\u3002MarkerObject\u306f\u30de\u30fc\u30ab\u8868\u9762\u3092(0,0,0)\u3068\u3059\u308b\u5ea7\u6a19\u7cfb\u3067\u3059\u306e\u3067\u3001\u8868\u793a\u7269\u306f\u8868\u9762\u304b\u3089\u4e0a\u65b9(Z\u8ef8)\u306b\u305a\u3089\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 60px;\">\u5358\u4f4d\u7cfb\u306b\u3064\u3044\u3066\u306f\u3001mm\u306b\u306a\u307e\u3059\u3002\u4f8b\u3048\u30704Cm\u306e\u7acb\u65b9\u4f53\u306e\u5834\u5408\u3001\u30b5\u30a4\u30ba40\u306e\u7acb\u65b9\u4f53\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30e9\u30a4\u30bb\u30f3\u30b9<\/h2>\n<p style=\"padding-left: 60px;\">NyARToolkitCS\/4.0.0a for Unity3D\u306fGPLv3\u3067\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u516c\u958b\u3059\u308b\u5834\u5408\u306b\u306f\u3001GPLv3\u3067\u3042\u308b\u3053\u3068\u306e\u8868\u793a\u3092\u304a\u9858\u3044\u3057\u307e\u3059\u3002\u5546\u7528\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u3064\u3044\u3066\u306f\u691c\u8a0e\u4e2d\u3067\u3059\u304c\u3001NyARToolkitCS\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u8cfc\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n<h2>\u65e2\u77e5\u306e\u4e0d\u5177\u5408<\/h2>\n<ul>\n<li>PC\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u4ee5\u5916\u3067\u52d5\u4f5c\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u306a\u3044\u3002<\/li>\n<li>Frustum\u30d1\u30e9\u30e1\u30fc\u30bf\u304c1\u7b87\u9069\u5f53<\/li>\n<li>320&#215;240\u4ee5\u5916\u3067\u8d77\u52d5\u3057\u305f\u3089Unity\u304c\u843d\u3061\u305f\u3002WebcamTexture\u306e\u554f\u984c?<\/li>\n<li>UnityTexture\u3068\u4e92\u63db\u6027\u306e\u3042\u308b\u753b\u50cf\u53d6\u5f97\u7cfbAPI\u304c\u306a\u3044\u3002<\/li>\n<li>Unity\u3068\u4e92\u63db\u6027\u306e\u3042\u308b\u5ea7\u6a19\u7cfb\u53d6\u5f97\u95a2\u6570\u304c\u8ca7\u5f31\u3002<\/li>\n<\/ul>\n<p style=\"padding-left: 30px;\"><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?lt1=_blank&amp;bc1=000000&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=nyatla-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=487311506X\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" width=\"320\" height=\"240\"><\/iframe><iframe loading=\"lazy\" style=\"width: 120px; height: 240px;\" src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?lt1=_blank&amp;bc1=000000&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=nyatla-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=B003XY8CZU\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" width=\"320\" height=\"240\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unity 3.5\u304b\u3089\u3001Web\u30ab\u30e1\u30e9\u304c\u624b\u8efd\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306d\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001NyARToolkitCS\u3092Unity\u306b\u5bfe\u5fdc\u3055\u305b\u307e\u3057\u305f\u3002\u6b63\u5f0f\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u307e\u3067\u306b\u306f\u3082\u3046\u5c11\u3057\u6642\u9593\u304c\u304b\u304b\u308b\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u03b1\u7248\u3092\u30ea\u30ea\u30fc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/490"}],"collection":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=490"}],"version-history":[{"count":15,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/490\/revisions"}],"predecessor-version":[{"id":754,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=\/wp\/v2\/posts\/490\/revisions\/754"}],"wp:attachment":[{"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nyatla.jp\/nyartoolkit\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}