{"id":685,"date":"2008-10-29T01:21:17","date_gmt":"2008-10-28T16:21:17","guid":{"rendered":"http:\/\/clockmaker.jp\/blog\/?p=685"},"modified":"2008-10-29T01:21:17","modified_gmt":"2008-10-28T16:21:17","slug":"alternativa3d_camera","status":"publish","type":"post","link":"https:\/\/clockmaker.jp\/blog\/2008\/10\/alternativa3d_camera\/","title":{"rendered":"Alternativa3D\u3092\u8a66\u3057\u3066\u307f\u308b Part.03 : Camera\u3068CameraController"},"content":{"rendered":"<p>AS3\u306e3D\u30e9\u30a4\u30d6\u30e9\u30ea\u300cAlternativa3D\u300d\u3092\u5b66\u7fd2\u3059\u308b\u30b7\u30ea\u30fc\u30ba\u7b2c\u4e09\u56de\u76ee\u3001\u4eca\u56de\u306f\u30ab\u30e1\u30e9\u306b\u3064\u3044\u3066\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h3>3D\u306e\u521d\u671f\u5316\u306b\u3064\u3044\u3066<\/h3>\n<p>\u307e\u3060\u89e3\u8aac\u3057\u3066\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001PV3D\u3068\u540c\u3058\u304f\u30ab\u30e1\u30e9\u30fb\u30b7\u30fc\u30f3\u30fb\u30d3\u30e5\u30fc\u306e3\u8981\u7d20\u304c\u3042\u308a\u3053\u308c\u3089\u3092\u521d\u671f\u5316\u3059\u308b\u3053\u3068\u304b\u3089\u306f\u3058\u3081\u307e\u3059\u3002<br \/>\n[source:javascript]<br \/>\n\/\/ \u30b7\u30fc\u30f3\u306e\u521d\u671f\u5316<br \/>\nscene = new Scene3D();<br \/>\n\/\/ \u30b7\u30fc\u30f3\u306e\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a(\u3053\u3053\u306b\u8272\u3093\u306a3D\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092addChild\u3057\u3066\u3044\u304d\u307e\u3059)<br \/>\nscene.root = new Object3D();<\/p>\n<p>\/\/ \u30ab\u30e1\u30e9\u3092\u521d\u671f\u5316<br \/>\ncamera = new Camera3D();<br \/>\n\/\/ scene.root\u306b\u30ab\u30e1\u30e9\u3092addChild<br \/>\nscene.root.addChild(camera);<\/p>\n<p>\/\/ \u30d3\u30e5\u30fc\u3092\u521d\u671f\u5316<br \/>\nview = new View();<br \/>\naddChild(view);<\/p>\n<p>\/\/ \u30d3\u30e5\u30fc\u306b\u30ab\u30e1\u30e9\u3092\u8a2d\u5b9a<br \/>\nview.camera = camera;<br \/>\n[\/source]<\/p>\n<p>\u305d\u3057\u3066\u3001Event.ENTER_FRAME\u306e\u30cf\u30f3\u30c9\u30e9\u30fc\u3067\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n[source:javascript]<br \/>\nscene.calculate();<br \/>\n[\/source]<\/p>\n<p>\u521d\u671f\u5316\u306b\u95a2\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u82e5\u5e72\u8a18\u6cd5\u304c\u9055\u3048\u3069\u3001\u6d41\u308c\u306fPV3D\u3068\u5909\u308f\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<h3>\u30ab\u30e1\u30e9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/h3>\n<p>Alternativa3D\u306b\u306f\u30ab\u30e1\u30e9\u3092\u30de\u30a6\u30b9\u3068\u30ad\u30fc\u30dc\u30fc\u30c9\u3067\u7c21\u5358\u306b\u5236\u5fa1\u3067\u304d\u308b\u3088\u3046\u306bCameraController\u3068\u3044\u3046\u30af\u30e9\u30b9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3069\u3046\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u3068\u3044\u3046\u3068\u6b21\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<p class=\"photo\"><a title=\"Alternative3D - CameraController | W:\u524d, S:\u5f8c, A:\u5de6, D:\u53f3, Z:\u4e0b, SPACE:\u4e0a\" rel=\"shadowbox;height=480;width=720;\" href=\"\/labs\/081028_alternativa3d\/bin\/main.swf\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-686\" title=\"081029_camera\" src=\"https:\/\/clockmaker.jp\/blog\/wp-content\/uploads\/2008\/10\/081029_camera.jpg\" alt=\"\" width=\"460\" height=\"200\" \/><\/a><\/p>\n<p>\u30ad\u30fc\u30dc\u30fc\u30c9\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u308a\u5236\u5fa1\u65b9\u5411\u306f\u6b21\u306e\u3068\u304a\u308a\u3002<\/p>\n<ul>\n<li> W \u2014 \u524d\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> S \u2014 \u5f8c\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> A \u2014 \u5de6\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> D \u2014 \u53f3\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> SPACE \u2014 \u4e0a\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> Z \u2014 \u4e0b\u306b\u9032\u307f\u307e\u3059<\/li>\n<li> UP \u2014 \u4e0a\u3092\u5411\u304d\u307e\u3059<\/li>\n<li> DOWN \u2014 \u4e0b\u3092\u5411\u304d\u307e\u3059<\/li>\n<li> LEFT \u2014 \u5de6\u306b\u50be\u3051\u307e\u3059<\/li>\n<li> RIGHT \u2014 \u53f3\u306b\u50be\u3051\u307e\u3059<\/li>\n<li> SHIFT \u2014 \u62bc\u3057\u306a\u304c\u3089\u3067\u5225\u306e\u30ad\u30fc\u3092\u62bc\u3059\u3068\u9032\u3080\u30b9\u30d4\u30fc\u30c9\u3092\u9ad8\u901f\u306b\u3057\u307e\u3059<\/li>\n<\/ul>\n<p>\u30ab\u30e1\u30e9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u6b21\u306e\u3068\u304a\u308a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n[source:javascript]<br \/>\n\/\/ 1.\u30ab\u30e1\u30e9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u521d\u671f\u5316 \u5f15\u6570\u306f\u30de\u30a6\u30b9\u30a4\u30d9\u30f3\u30c8\u3092\u53d7\u3051\u53d6\u308bDisplayObject<br \/>\ncameraController = new CameraController(stage);<br \/>\n\/\/ 2.\u30ab\u30e1\u30e9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u5236\u5fa1\u3059\u308b\u30ab\u30e1\u30e9\u3092\u6307\u5b9a<br \/>\ncameraController.camera = camera;<br \/>\n\/\/ 3.\u30ad\u30fc\u30dc\u30fc\u30c9\u64cd\u4f5c\u3092\u53ef\u80fd\u306b\u3059\u308b\u6a5f\u80fd<br \/>\ncameraController.setDefaultBindings();<br \/>\n\/\/ 4.\u885d\u7a81\u3057\u305f\u3089\u30ab\u30e1\u30e9\u3092\u9032\u307e\u306a\u304f\u3055\u305b\u308b\u304b\u306e\u8a2d\u5b9a<br \/>\ncameraController.checkCollisions = true;<br \/>\n\/\/ 5.\u885d\u7a81\u5224\u5b9a\u306e\u534a\u5f84(\u7403\u306e\u5f62\u3067\u5224\u5b9a)<br \/>\ncameraController.collisionRadius = 0;<br \/>\n\/\/ 6.\u30ab\u30e1\u30e9\u306e\u76ee\u6a19\u70b9\u3092\u8a2d\u5b9a<br \/>\ncameraController.lookAt(new Point3D());<br \/>\n\/\/ 7.\u30ab\u30e1\u30e9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u5236\u5fa1\u306e\u8a2d\u5b9a<br \/>\ncameraController.controlsEnabled = true;<br \/>\n[\/source]<\/p>\n<h3>\u4eca\u56de\u306e\u30bd\u30fc\u30b9<\/h3>\n<ul>\n<li><a href=\"\/labs\/081028_alternativa3d\/src\/Main.txt\">src <\/a>(130\u884c, as\u30d5\u30a1\u30a4\u30eb)<\/li>\n<\/ul>\n<h3>\u53c2\u8003<\/h3>\n<ul>\n<li><a title=\"CameraController - Alternativa3D API Doc\" href=\"http:\/\/help.alternativaplatform.com\/en\/client\/alternativa\/engine3d\/controllers\/CameraController.html\" target=\"_blank\">CameraController &#8211; Alternativa3D API Doc<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>AS3\u306e3D\u30e9\u30a4\u30d6\u30e9\u30ea\u300cAlternativa3D\u300d\u3092\u5b66\u7fd2\u3059\u308b\u30b7\u30ea\u30fc\u30ba\u7b2c\u4e09\u56de\u76ee\u3001\u4eca\u56de\u306f\u30ab\u30e1\u30e9\u306b\u3064\u3044\u3066\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts\/685"}],"collection":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/comments?post=685"}],"version-history":[{"count":0,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/posts\/685\/revisions"}],"wp:attachment":[{"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/media?parent=685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/categories?post=685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clockmaker.jp\/blog\/wp-json\/wp\/v2\/tags?post=685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}