1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

A-Frameでマイクラみたいなの

Last updated at Posted at 2024-09-24

A-Frame

A-FrameとはHTMLとJavaScriptを使用して3DとかVRとか作れるやつです

サイトを見るとサンプルが色々あって面白いです

試してみると・・・

HTMLタグだけで3Dの図形ができるのでマイクラみたいにしたくなりました

// これだけで3dの箱が設置される!
<a-box position="0 0 0" color="green" />

作ったサンプル

m2.gif

WASDでカメラ移動、QEで上昇下降、クリックすると赤いレティクルの位置にブロックを設置します

PC&chromeでしか動作確認してません

URL: https://babu-ch.github.io/aframe-micra/

メインのソース: https://github.com/babu-ch/aframe-micra/blob/main/src/main.ts

結構それっぺぇですよね

地面を緑のブロックで埋めて、クリックするとその面にブロックを生やす実装です

おわり

さすがにブロック多いと重いです

でもこの実装が60行くらいでできるのでA-Frameすごいですよね :thumbsup:

github: https://github.com/babu-ch/aframe-micra

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?