This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

25
book/city/01_remove.md Normal file
View File

@ -0,0 +1,25 @@
# 惑星形式のmapを作る
game engineのmapは基本的に平面で作られています。どこまで行っても地平線が広がっているだけで、そこから抜け出すことはできません。月や太陽があっても背面の絵を動かしているだけです。
これを現実に合わせた形にします。地球があって、上に飛ぶと大気圏があり、大気圏を抜けると宇宙があり、月があり、太陽があるという形にすることを目指します。全てはつながっていて、そこに行くことができます。これを`planet system`と呼ぶことにします。
基本的に`/Map/Small_City_LVL`を使って構築していきます。
## 海の境界を消す
city sampleの海には境界があってcollisionが設定されています。邪魔になるので消します。
`GroundCollisionCube`,`DroneBlockingVolume`を探して削除します。
## ultra dynamic skyで天候と惑星を作る
[こちら](/plan/02_uds.html)
## ocean wavesで惑星の海を作る
[こちら](/plan/03_ocean.html)
## worldscape pluginを使う
[こちら](/plan/07_wsp.html)

9
book/city/02_bridge.md Normal file
View File

@ -0,0 +1,9 @@
# 橋を作る
[automotive bridge scene](https://www.fab.com/ja/listings/a472df9d-9179-4743-8d41-335f9ef55546)
1. `/Content/AutomotiveBridgeScene/Blueprints/BP_CurvedBridge`, `BP_StraightBridge`を開きます。これをつなぎ合わせていくことで橋を作ります。
2. Lampが動きませんので、選択した上で`Static Mesh``city sample`に入っている`/Content/Prop/Kit_StreetLamp_C/Mesh/streetLampC`と入れ替えます。
3. 私はベンチのところを`traversable(トラバーサブル)`するためにGASの`/Content/LevelPrototyping/LevelBlock_Traversable`を入れています。Base Materialを`/Content/Characters/Echo/Materials/M_hide`にして透明にします。
![](../img/0003.png)

9
book/city/03_house.md Normal file
View File

@ -0,0 +1,9 @@
# 家を作る
1. [twinmotion](https://www.twinmotion.com/)をinstallして、建造物を作ります。template(テンプレート)を編集しても構いません。
2. できたらexportしてueの$projectを選択します。`$project/${name}_Assets`が作成されます。`datasmith`の置き場所は変更しても構いません。
3. $projectを開いて、pluginの`datasmith`を入れます。そして、`$name (Datasmith シーン)`のファイルをmapにD&Dします。
4. すり抜け問題を解消するには作成された`mesh`を全選択して、右クリックで`アセットアクション -> プロパティマトリクスで選択内容を... -> collision complexity(use complex collision as simple...)`を選択します。
> 私の場合はmeshが`/Content/Twinmotion/room/Geometries/`にあります。
<iframe width="100%" height="415" src="https://www.youtube.com/embed/BsLOlAr-wBY?si=jahPUVD8YMMfefvm&start=152&end=160&mute=1&rel=0&showinfo=0&controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

6
book/city/04_bgm.md Normal file
View File

@ -0,0 +1,6 @@
## 音楽を作る
例えば、BGMの一部を変更したい場合は、`プロジェクト設定 -> ゲーム -> World Audio Data`を見てください。
私はmatrix(マトリックス)のテーマを消したかったので、`/Content/Audio/MetaSounds/Music/`にある`music_leavebehind_New_Mix_Meta`, `music_leavebehind_New_Mix_NHT_Meta`の音量を`0.0`にしました。

27
book/city/05_browser.md Normal file
View File

@ -0,0 +1,27 @@
# ブラウザを作る
1. pluginで`web browser`を有効にします。
2. 下記のような緑背景のmaterialを作成します。
> [https://blueprintue.com/blueprint/-49_059w/](https://blueprintue.com/blueprint/-49_059w/)
3. web browserを使ったwidgetを作成します。
4. BP_browserに追加したwidget componentで呼び出します。collisionでcontrolします。
> [https://blueprintue.com/blueprint/uubw_6ay/](https://blueprintue.com/blueprint/uubw_6ay/)
4. displayにくっつければ見栄えも良くなります。
> https://www.unrealengine.com/marketplace/ja/product/twinmotion-high-tech-pack-1
![](/img/0014.png)
画像はNASAの[solar system](https://eyes.nasa.gov/apps/solar-system/#/home)にアクセスしたときのもの。
- https://eyes.nasa.gov/apps/asteroids/#/planets/earth
## issue: 表示されなくなったサイト
[こちら](/issue/city/city_07.html)を見てください。
## webでUIやシステムを作る
これを利用すると、webで動くUIやシステムを作成し、ゲームに取り入れることができます。
しかし、運用は大変だと思います。

10
book/city/06_spline.md Normal file
View File

@ -0,0 +1,10 @@
# 惑星を動かす
splineで惑星を動かします。
1. `BP_Spline`を作成し、componentでsplineを追加し、右クリックで生成パネルを出す
2. 円弧を選択し、90のところを360にする。あとは大きさを変更する数値を大きくする
3. 次にsplineで動かしたいBPを開いて、`BP_Spline`を入れます。
4. 処理をTickに追加する。なお、`BP_Spline(子アクター)`から持ってくる場合は`Get Child Actor`, `Get Component by Class: Spline Component`を使用します。
<iframe src="https://blueprintue.com/render/8gfrd45h/1" scrolling="no" width="100%" height="450px" allowfullscreen=""></iframe>

87
book/city/07_teleport.md Normal file
View File

@ -0,0 +1,87 @@
# 惑星間の移動
惑星間の移動表現を銀河系の光で演出します。
1. sketchfabのgalaxyをbrowserで表示する
2. ボタンが押されたとき移動先へ移動する
<iframe width="100%" height="415" src="https://www.youtube.com/embed/Ub0B91UtGQI?rel=0&showinfo=0&controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
## sketchfab api
apiを使ってzoom-in, zoom-outします。
```html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sketchfab Viewer API example</title>
<script type="text/javascript" src="https://static.sketchfab.com/api/sketchfab-viewer-1.12.1.js"></script>
</head>
<body>
<iframe id="api-frame" class="w-full" width="100%" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%;" allow="xr-spatial-tracking; autoplay; fullscreen; xr-spatial-tracking; accelerometer" xr-spatial-tracking web-share frameborder="no" scrolling="no" ></iframe>
<script type="text/javascript">
var iframe = document.getElementById( 'api-frame' );
var uid = 'd6521362b37b48e3a82bce4911409303';
var client = new Sketchfab( iframe );
var api;
client.init( uid, {
success: function onSuccess( api ){
api.start({ preload:1 });
api.addEventListener( 'viewerready', function() {
api.getCameraLookAt((err, camera) => {
if (err) return console.error('カメラ取得失敗');
const direction = [
camera.position[0] - camera.target[0],
camera.position[1] - camera.target[1],
camera.position[2] - camera.target[2]
];
const zoomFactor = 0.01;
const newPosition = [
camera.target[0] + direction[0] * zoomFactor,
camera.target[1] + direction[1] * zoomFactor,
camera.target[2] + direction[2] * zoomFactor
];
api.setCameraLookAt(newPosition, camera.target, 10, (err) => {
if (!err) console.log('ズームアウト成功');
});
});
} );
},
error: function onError() {
console.log( 'Viewer error' );
},
camera:1,
autospin: 0,
preload: 0,
ui_controls: 0,
ui_infos: 0,
ui_inspector: 0,
ui_stop: 0,
ui_watermark: 0,
ui_watermark_link: 0,
ui_annotations: 0,
ui_hint: 0,
ui_ar:0,ui_help:0,
ui_settings:0,
ui_vr:0,
ui_fullscreen:0,
ui_loading: 0,
} );
</script>
</body>
</html>
```
## 本来やりたかったこと
本来はキャラクターの動きと空間が連動するようにしたかったです。
これはniagaraで空間ごと表現する方法がありますが、スペック的に可能かはわかりません。
また、playerのcameraにniagaraをくっつけて表現する方法があります。これは低負担で実装できますが、実態と異なり、playerの移動と連動して光の中を飛んでいるように見せるだけです。
実際に光の中を飛べるようにするのが理想ですが、ueでは難しいかもしれません。

View File

@ -0,0 +1,325 @@
{
"FileVersion": 3,
"EngineAssociation": "5.5",
"Category": "Samples",
"Description": "",
"Modules": [
{
"Name": "CitySample",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine",
"AIModule",
"ChaosVehicles",
"UMG",
"MovieScene"
]
},
{
"Name": "CitySampleEditor",
"Type": "Editor",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
},
{
"Name": "CitySampleAnimGraphRuntime",
"Type": "UncookedOnly",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "AlembicHairImporter",
"Enabled": true
},
{
"Name": "HairStrands",
"Enabled": true
},
{
"Name": "PythonScriptPlugin",
"Enabled": true
},
{
"Name": "ControlRig",
"Enabled": true
},
{
"Name": "Takes",
"Enabled": true
},
{
"Name": "D3DExternalGPUStatistics",
"Enabled": true,
"Optional": true,
"SupportedTargetPlatforms": [
"Win64"
]
},
{
"Name": "LiveLinkCurveDebugUI",
"Enabled": true
},
{
"Name": "ChaosVehiclesPlugin",
"Enabled": true
},
{
"Name": "RigLogic",
"Enabled": true
},
{
"Name": "RawInput",
"Enabled": true
},
{
"Name": "GameplayInsights",
"Enabled": true
},
{
"Name": "TraceSourceFilters",
"Enabled": true
},
{
"Name": "TraceDataFilters",
"Enabled": true
},
{
"Name": "ModelingToolsEditorMode",
"Enabled": true
},
{
"Name": "Traffic",
"Enabled": true
},
{
"Name": "CitySampleMassCrowd",
"Enabled": true
},
{
"Name": "StateTree",
"Enabled": true
},
{
"Name": "OnlineSubsystem",
"Enabled": true
},
{
"Name": "OnlineSubsystemUtils",
"Enabled": true
},
{
"Name": "MassAI",
"Enabled": true
},
{
"Name": "MassCrowd",
"Enabled": true
},
{
"Name": "MassEntity",
"Enabled": true
},
{
"Name": "MassGameplay",
"Enabled": true
},
{
"Name": "HoverDrone",
"Enabled": true
},
{
"Name": "EnhancedInput",
"Enabled": true
},
{
"Name": "Volumetrics",
"Enabled": true
},
{
"Name": "ContextualAnimation",
"Enabled": true
},
{
"Name": "ChaosCaching",
"Enabled": true
},
{
"Name": "FieldSystemPlugin",
"Enabled": true
},
{
"Name": "Paper2D",
"Enabled": true
},
{
"Name": "WinDualShock",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64"
]
},
{
"Name": "ZoneGraph",
"Enabled": true
},
{
"Name": "AnimationWarping",
"Enabled": true
},
{
"Name": "ElectraPlayer",
"Enabled": true
},
{
"Name": "LiveLinkCamera",
"Enabled": true
},
{
"Name": "AudioModulation",
"Enabled": true
},
{
"Name": "Metasound",
"Enabled": true
},
{
"Name": "MovieRenderPipeline",
"Enabled": true
},
{
"Name": "Soundscape",
"Enabled": true
},
{
"Name": "FullBodyIK",
"Enabled": true
},
{
"Name": "RemoteControl",
"Enabled": true
},
{
"Name": "ImagePlate",
"Enabled": true
},
{
"Name": "LightWeightInstancesEditor",
"Enabled": true
},
{
"Name": "GameFeatures",
"Enabled": true
},
{
"Name": "ModularGameplay",
"Enabled": true
},
{
"Name": "CitySampleSensorGrid",
"Enabled": true
},
{
"Name": "IKRig",
"Enabled": true
},
{
"Name": "ColorCorrectRegions",
"Enabled": true
},
{
"Name": "Gauntlet",
"Enabled": true
},
{
"Name": "CustomizableSequencerTracks",
"Enabled": true
},
{
"Name": "NetworkPrediction",
"Enabled": true
},
{
"Name": "NiagaraFluids",
"Enabled": true
},
{
"Name": "Text3D",
"Enabled": true
},
{
"Name": "MotoSynth",
"Enabled": true
},
{
"Name": "EditorDataStorage",
"Enabled": true
},
{
"Name": "EditorDataStorageFeatures",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "AnimToTexture",
"Enabled": true
},
{
"Name": "SequencerScripting",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "GeometryCollectionPlugin",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "AutomatedPerfTesting",
"Enabled": true
},
{
"Name": "LiveLink",
"Enabled": true
},
{
"Name": "LiveLinkControlRig",
"Enabled": true
},
{
"Name": "PoseSearch",
"Enabled": true
},
{
"Name": "AnimationLocomotionLibrary",
"Enabled": true
},
{
"Name": "MotionWarping",
"Enabled": true
},
{
"Name": "Chooser",
"Enabled": true
},
{
"Name": "Mover",
"Enabled": true
}
],
"TargetPlatforms": [
"PS5",
"XSX",
"Windows"
],
"EpicSampleNameHash": "111"
}

View File

@ -0,0 +1,5 @@
[/Script/Engine.CollisionProfile]
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel11,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="Traversable")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel12,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="EnemyProjectile")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel13,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="BulletHell")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel14,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="LookAtTrace")

385
book/city/README.md Normal file
View File

@ -0,0 +1,385 @@
# city sample
[city sample](https://www.unrealengine.com/marketplace/ja/product/city-sample)
ニューヨーク(NY)をモデルに都市が作られています。人と自動車が動いています。自動車は乗ることや破壊することができます。
## game animation sampleとの統合
他のassetとの統合を考えるとき、city sampleをベースにします。なぜなら、city sampleは複雑すぎるためです。ここではcity sampleをinstallした上で、game animation sampleをそこにcopyします。
なお、`GameAnimationSample/Binaries/Win64/UnrealEditor.modules`だけはcopyしません。
```sh
# 以下のfileをcopy
GameAnimationSample
Binaries
Win64/UnrealEditor.modules #このfileだけはcopy(rewrite)しない
Build
Content
```
次に`CitySample/Binaries/Win64/UnrealEditor.modules`を編集します。
```json
{
"BuildId": "xxx",
"Modules":
{
"CitySample": "UnrealEditor-CitySample.dll",
"CitySampleAnimGraphRuntime": "UnrealEditor-CitySampleAnimGraphRuntime.dll",
"CitySampleEditor": "UnrealEditor-CitySampleEditor.dll"
},
{
"GameAnimationSample": "UnrealEditor-GameAnimationSample.dll"
}
}
```
これでGASPが機能すればokです。
他には`$project/Config``$project/xxx.uproject`を見比べてみましょう。必要そうなものを追記します。
```json
{
"FileVersion": 3,
"EngineAssociation": "5.5",
"Category": "Samples",
"Description": "",
"Modules": [
{
"Name": "CitySample",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine",
"AIModule",
"ChaosVehicles",
"UMG",
"MovieScene"
]
},
{
"Name": "CitySampleEditor",
"Type": "Editor",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
},
{
"Name": "CitySampleAnimGraphRuntime",
"Type": "UncookedOnly",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "AlembicHairImporter",
"Enabled": true
},
{
"Name": "HairStrands",
"Enabled": true
},
{
"Name": "PythonScriptPlugin",
"Enabled": true
},
{
"Name": "ControlRig",
"Enabled": true
},
{
"Name": "Takes",
"Enabled": true
},
{
"Name": "D3DExternalGPUStatistics",
"Enabled": true,
"Optional": true,
"SupportedTargetPlatforms": [
"Win64"
]
},
{
"Name": "LiveLinkCurveDebugUI",
"Enabled": true
},
{
"Name": "ChaosVehiclesPlugin",
"Enabled": true
},
{
"Name": "RigLogic",
"Enabled": true
},
{
"Name": "RawInput",
"Enabled": true
},
{
"Name": "GameplayInsights",
"Enabled": true
},
{
"Name": "TraceSourceFilters",
"Enabled": true
},
{
"Name": "TraceDataFilters",
"Enabled": true
},
{
"Name": "ModelingToolsEditorMode",
"Enabled": true
},
{
"Name": "Traffic",
"Enabled": true
},
{
"Name": "CitySampleMassCrowd",
"Enabled": true
},
{
"Name": "StateTree",
"Enabled": true
},
{
"Name": "OnlineSubsystem",
"Enabled": true
},
{
"Name": "OnlineSubsystemUtils",
"Enabled": true
},
{
"Name": "MassAI",
"Enabled": true
},
{
"Name": "MassCrowd",
"Enabled": true
},
{
"Name": "MassEntity",
"Enabled": true
},
{
"Name": "MassGameplay",
"Enabled": true
},
{
"Name": "HoverDrone",
"Enabled": true
},
{
"Name": "EnhancedInput",
"Enabled": true
},
{
"Name": "Volumetrics",
"Enabled": true
},
{
"Name": "ContextualAnimation",
"Enabled": true
},
{
"Name": "ChaosCaching",
"Enabled": true
},
{
"Name": "FieldSystemPlugin",
"Enabled": true
},
{
"Name": "Paper2D",
"Enabled": true
},
{
"Name": "WinDualShock",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64"
]
},
{
"Name": "ZoneGraph",
"Enabled": true
},
{
"Name": "AnimationWarping",
"Enabled": true
},
{
"Name": "ElectraPlayer",
"Enabled": true
},
{
"Name": "LiveLinkCamera",
"Enabled": true
},
{
"Name": "AudioModulation",
"Enabled": true
},
{
"Name": "Metasound",
"Enabled": true
},
{
"Name": "MovieRenderPipeline",
"Enabled": true
},
{
"Name": "Soundscape",
"Enabled": true
},
{
"Name": "FullBodyIK",
"Enabled": true
},
{
"Name": "RemoteControl",
"Enabled": true
},
{
"Name": "ImagePlate",
"Enabled": true
},
{
"Name": "LightWeightInstancesEditor",
"Enabled": true
},
{
"Name": "GameFeatures",
"Enabled": true
},
{
"Name": "ModularGameplay",
"Enabled": true
},
{
"Name": "CitySampleSensorGrid",
"Enabled": true
},
{
"Name": "IKRig",
"Enabled": true
},
{
"Name": "ColorCorrectRegions",
"Enabled": true
},
{
"Name": "Gauntlet",
"Enabled": true
},
{
"Name": "CustomizableSequencerTracks",
"Enabled": true
},
{
"Name": "NetworkPrediction",
"Enabled": true
},
{
"Name": "NiagaraFluids",
"Enabled": true
},
{
"Name": "Text3D",
"Enabled": true
},
{
"Name": "MotoSynth",
"Enabled": true
},
{
"Name": "EditorDataStorage",
"Enabled": true
},
{
"Name": "EditorDataStorageFeatures",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "AnimToTexture",
"Enabled": true
},
{
"Name": "SequencerScripting",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "GeometryCollectionPlugin",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "AutomatedPerfTesting",
"Enabled": true
},
{
"Name": "LiveLink",
"Enabled": true
},
{
"Name": "LiveLinkControlRig",
"Enabled": true
},
{
"Name": "PoseSearch",
"Enabled": true
},
{
"Name": "AnimationLocomotionLibrary",
"Enabled": true
},
{
"Name": "MotionWarping",
"Enabled": true
},
{
"Name": "Chooser",
"Enabled": true
},
{
"Name": "Mover",
"Enabled": true
}
],
"TargetPlatforms": [
"PS5",
"XSX",
"Windows"
]
}
```
また、`/Config/DefaultEngine.ini`に注意してください。
```sh
[/Script/Engine.CollisionProfile]
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel11,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="Traversable")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel12,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="EnemyProjectile")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel13,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="BulletHell")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel14,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="LookAtTrace")
```
`Collision Trace Channel`は作り直さなければ機能しないことがあります。
### 問題の数々
問題の数々は[こちら](/issue/)でまとめています。