おすすめコンテンツ

とくにYoutubeへは有象無象をUPしているので、

おすすめコンテンツをここでまとめておきます。

 

Unityアセット「SkinnedMetaballBuilder」(宣伝)

メタボールっぽいものを扱うアセットです

http://u3d.as/gAE(ストア)

http://nkdtr.hatenablog.com/entry/2015/06/11/000322(マニュアル)

・掘れる壁のデモ(アセット内に同梱)

youtu.be

・エディタでマップ生成

www.youtube.com

 

Portal

わりと有名なゲームの真似事。

ワープ先の映像が見えており、視界が連続したままワープできる仕掛けです。

qiita.com

動画(Unity)

youtu.be

動画(UE4)

youtu.be

 

MarchingCubesによる曲面、武器の軌跡のスカラー場への作用(UE4)

毎フレームLineTraceするような方法ではきれいに切れないので、

フレーム間の軌跡を扇形と見なしてその領域を削り取ります。

youtu.be

 

シェーダー、RenderTextureを用いた波紋(Unity)

波動方程式を解いているだけですが、

実装方法に面白みがあると思います。

qiita.com

youtu.be

 

マウスの軌跡をメッシュ化

下の二つの記事の内容を使っています。

qiita.com

・今では公式にProceduralMeshComponentが実装され(Experimental)不要に。。。

qiita.com

連続した座標をつないでパイプ状のメッシュを作ります。

時間差で相似形を追加し枝分かれしたように見せています。

youtu.be

 

レイマーチング法

Unityでやっている人がいたので、UE4でやってみました。

今ではVolumeDecalsが公式に実装され不要に。。。

qiita.com

youtu.be

・金色の螺旋はこういうメッシュが存在するわけではなく、カメラの前に置かれた板にマテリアルで描かれています。

 

UE4マテリアル入門記事

PBRとかフォトリアルとかは他の人に聞いてください。

エフェクトとしてのマテリアルのための記事です。

qiita.com

qiita.com

qiita.com

qiita.com

qiita.com

 

ツイッター遊び

ツイッターAPIを使ってみる遊び(Unity)

軌道に特に意味はなく単に遊び心です。

www.youtube.com

 

UE4ぷちコン

第三回

youtu.be

第四回

youtu.be

第4回UE4ぷちコン 投稿作品について

 

f:id:nkdtr:20151008200603p:plain

 

↓これに「REFLEKT」というタイトルの縦スクロールシューティングゲームを作って投稿しました。

historia.co.jp

 

概要

シューティングゲームです。

パワーアップとかはありません。

ライフ制、一回死ぬか全2ステージクリアでゲームオーバーです。

 

プレイヤー、エネミー共に兵器は射程無限の光速ビームのみ

 

3種類の特殊操作
 ・ビーム強化:そのまま。でも無策に使うと死を招く
 ・壁の鏡面化:壁を鏡面化しビームを反射させる。無策に使うと死を招く
 ・敵の捕獲:近隣の敵を捕獲して盾とする。ビームを射つ敵は武器にもなる。捕獲した敵に気を取られて死にやすい

 

[BGM] 魔王魂 様(http://maoudamashii.jokersounds.com/)
[SE] 効果音ラボ 様(http://maoudamashii.jokersounds.com/)

 

動画

youtu.be

 

実行ファイル(Win64ゲームパッド推奨(キーボードにも対応))

及びプロジェクト(音素材抜き)

https://drive.google.com/folderview?id=0B_cqTvJRhk3fNzR5ekpqV3hrTHM&usp=sharing

 

 

反射

テーマが「反射」であったのでそれに見合った要素を組み込んでいます。

難しいことではありませんが、工夫した部分ではあるので軽く説明しておきます。

 

1.ビームの反射

f:id:nkdtr:20151008194500p:plain

毎フレーム発射地点からLineTraceを用いて衝突判定を行い、対象が反射素材のときMirrorVectorを用いて方向を転換、衝突地点から再度LineTraceを行うことで繰り返し反射するのを表現しています。

衝突対象にエフェクトを表示したりダメージを与えたりの処理もここで行います。

 

参考:

Beam(BlueprintClass) のTrace及びTraceSegment関数

 

2.ゲームシーンの鏡像表示

f:id:nkdtr:20151008194709p:plain

壁を鏡面化しているとき、シーンカラーが反転するとともに左右に鏡像が表示されます。

SceneCapture2Dでゲームをいったんテクスチャに書き込み、それをマテリアルで左右反転して板に張り付けることで実現しています。

要するに、実際のシーンには直方体がぴったりくっついて三つ並んでいる形です。

色の反転もついでに行います(反転する/しない はパラメータで変更)。

 

参考:

MainScenePanelMirrored(Material)

 

感想

 ・欲しい絵はできたのでおおむね満足

・はじめてシューティングゲームを作った。ゲームらしいものを作るのも楽しい

・でも次があったらゲーム性は捨てて変なもん作る

Skinned Metaball Builder -インクリメンタルモード-

Skinned Metaball Builder Manual -インクリメンタルモード-

 

"Incremental Modeling" Prefabが ver.1.10 で追加されました.

 

FEATURES

-スキニングなし

-配置したプリミティブを動かすことはできません

-プリミティブ数が増えることによるパフォーマンスへの影響は比較的軽微です

-Sphere/Box二種類のプリミティブが使用できます

-プリミティブのスケール/回転に対応しています

-このモードを使用したゲームライクなサンプルシーン"dungeon2"が追加されています

 https://youtu.be/ZhvNbr7iI7Y

  

 

QUICK START

youtu.be

-"Metaball/Prefabs/IncrementalModeling" prefab をシーンへ配置します

-配置した "IncrementalModeling" の下にある Sphere/BoxBrush を選択します

-選択したBrushの位置や形状を調整します

-"Shift"+"Ctrl/Command"+"E" を押すとプリミティブが配置されメッシュに反映されます

 

Commands

コンポーネントを右クリックすることでコマンドを表示・実行できます。

 

Rebuild : 

 Historyに従ってメッシュを再生成します。

この際、”FixedBounds" や "GridSize"プロパティが再適用されます。

形状が再現されるためには、Historyが完全に残っている必要があります。

 

Clear History:

 Historyを消去します。

Meshはそのまま残ります。

Meshもクリアしたい場合は、つづけてRebuildを実行してください。

 

Properties

ほとんどのプロパティは以前からあるStatic/SkinnedMetaballSeedと同等です。 そちらのリファレンスを参照してください。(http://nkdtr.hatenablog.com/entry/2015/06/10/234607)

以下のものはIncrementalModelingに特有です。

 

Save Brush History :

 "Rebuild"で使用されるHistoryを保存するかどうかを指定します。

 

Brush History :

 保存されたHistoryです。

これを直接編集しRebuildを実行することでメッシュを更新できますが、簡単ではありません(可視化などのツールサポートを実装していません)。

Skinned Metaball Builder Manual -Incremental Mode-

Skinned Metaball Builder Manual -Incremental Mode-

 

"Incremental Modeling" prefab has been added in version 1.10.

 

FEATURES

-NO SKINNING

-Node cannot be moved after placed

-Smaller impact on performance by adding metaball primitives

-Sphere and box primitives available

-Scale and Rotation can- be applied on primitives

-New game-like sample scene "dungeon2" added

 https://youtu.be/ZhvNbr7iI7Y

  

 

QUICK START

youtu.be

-Place "Metaball/Prefabs/IncrementalModeling" prefab on hierarchy

-Select Sphere/BoxBrush under "IncrementalModeling" instance created.

-Modify the position and the shape of the brush

-"Shift"+"Ctrl/Command"+"E" to place the primitive

 

Commands

Right click the component to show and execute commands.

 

Rebuild : 

 Rebuild the mesh by history.

Current "Fixed bounds", "Grid size" are applied correctly.

"Brush History" is required to do this.

 

Clear History:

 Clear current brush history.

Mesh is kept.

If you want your mesh to be cleared also,

do "Rebuild" after this.

 

Properties

Most of the properties are similar to previous Static/Skinned Metaball Seeds,

please refer (http://nkdtr.hatenablog.com/entry/2015/06/05/123458)

Ones below are specific to IncrementalModeling component.

 

Save Brush History :

 Decides save the history that is required to do "Rebuild".

 

Brush History :

 Saved history.

You can modify the history via this property, and do rebuild to apply the modification.

But its not so easy (there is no special tool support(like visualization) for this).

まんが保管庫

まんが保管庫

ユニティちゃんときまぐれお勉強タイム

このコンテンツは、『ユニティちゃんライセンス』で提供されています。

 

ベクトル等の基礎知識について、

個人的に思うツボ的なところを解説していくつもりです。

よく分からないけど何となく使ってる人の助けになればと思います。

 

いちから説明する教科書とは違います。

読んでて詰まる人は数学の教科書から。

 

#1 基底ベクトルと座標系

f:id:nkdtr:20150824231637p:plain

f:id:nkdtr:20150824231722p:plain

f:id:nkdtr:20150824231749p:plain

 

#2 座標と座標系

f:id:nkdtr:20150824233640p:plain

f:id:nkdtr:20150824233654p:plain

f:id:nkdtr:20150824233707p:plain

 

#3 ドット積・射影

f:id:nkdtr:20150824233726p:plain

f:id:nkdtr:20150824233944p:plain

f:id:nkdtr:20150824233959p:plain

 

Sprite ROKURO Manual

f:id:nkdtr:20150821105711p:plain

Sprite ROKURO Manual

"ROKURO" means "potter's wheel" in Japanese.

You can create revolution shaped mesh from sprite with this asset.

Please watch the quick start video below.

 

Store

https://www.assetstore.unity3d.com/en/#!/content/44326

 

Quick Start

youtu.be

 
1. Import an image file with alpha channel.
2. Set the texture type "Sprite" and press "Apply" button.
3. Drag and drop the prefab "Rokuro" onto the hierarchy.
4. Drag and drop the sprite (made in step 2) onto the PolygonCollider in the Rokuro instance.
5. Adjust the PolygonCollider by Offset so that it makes the correct shape when rotated.
6. Right click the Rokuro component and press "Build".
7. If the surface is reversed, toggle the "Reverse" checkbox and retry "Build".

 

Reference

Commands

Right click on the Rokuro component to execute commands.

 

Build

Build a mesh by rotating PolygonCollider information.

 

SaveMeshAsAsset

Save the mesh as an asset.

Saved asset can be applied to any MeshFilters or MeshColliders.

 

Parameters

FlatSection

If checked, surface is "virtically" flat.

f:id:nkdtr:20150820230817p:plain

 

FlatRotation
If checked, surface is "horizontally" flat.

f:id:nkdtr:20150820230812p:plain

HorizontalResolution

How many circle is divied into.

This must be equal to or larger than 3.

f:id:nkdtr:20150820231055p:plainHorizontalResolution=4

f:id:nkdtr:20150820231212p:plainHorizontalResolution=32

 

Reverse

If checked, created surface will be reversed.

In which case it "looks" reversed depends on the relative position of the shape of PolygonCollider to rotation axis.

 

EnableSubmesh

If checked and the sprite has multiple parts, mesh will be separated into submeshes.

Then MeshRenderer is required to contain as many materials as submeshes to be rendered correctly.

The order of submeshes cannot be controled.

 

Sprite ROKURO マニュアル

f:id:nkdtr:20150821105711p:plain

Sprite ROKURO マニュアル

スプライトを用いて、簡単に回転体のメッシュを作成できるアセットです。

下のムービーをご覧ください。

 

ストア

https://www.assetstore.unity3d.com/en/#!/content/44326

 

クイックスタート

youtu.be

 
1. アルファチャンネル付きのイメージをインポートする
2. TextureTypeを "Sprite" にして "Apply" ボタンを押す
3. "Rokuro"プレハブをヒエラルキーにドラッグ&ドロップする
4. スプライト (2で作成したもの) を 3でヒエラルキー上に作成した "Rokuro"の PolygonColliderへドラッグ&ドロップする
5. PolygonColliderのOffsetを編集して位置を合わせる
6. Rokuroコンポーネントを右クリックし、"Build"を選択する
7. 面が裏向きになってしまった場合、"Reverse"のチェックを変更し、"Build"し直す

 

リファレンス

コマンド

Rokuroコンポーネントを右クリックしてコマンドを選択することによって実行します。

 

Build

PolygonCollider の形状を回転させてメッシュを生成します。

 

SaveMeshAsAsset

メッシュをアセットとして保存します。

保存したメッシュはMeshFilterやMeshColliderにセットして使えます。

 

プロパティ

FlatSection

チェックされているとき、面は「垂直方向」についてフラットになります。

f:id:nkdtr:20150820230817p:plain

 

FlatRotation
チェックされているとき、面は「水平方向」についてフラットになります。

f:id:nkdtr:20150820230812p:plain

HorizontalResolution

回転体を作るときに一周を何分割するかを指定します。

3以上である必要があります。

f:id:nkdtr:20150820231055p:plainHorizontalResolution=4

f:id:nkdtr:20150820231212p:plainHorizontalResolution=32

 

Reverse

チェックされているとき、面を裏返します。

いずれの場合に「見た目上」裏向きになるかは、

PolygonCollideraの形状と回転軸との位置関係で決まります。

 

EnableSubmesh

これがチェックされていてスプライトが複数の部分から成るとき、

その数だけSubMeshを生成します。

このとき、MeshRendererにはSubMeshと同数のMaterialが設定されていなければ正常に表示されません(Materialの足りない部分については描画されません)。

SubMeshの順序について制御することはできません。