
[Unreal Engine] Editor Utility Blue Printでdialogを途中から表示するには
EUB上で Show Message Dialogノードを使う

eub ue5 blueprint dialog editor utility blueprint
[Unreal Engine] Editor Utility Blue Printでdialogを途中から表示するには
EUB上で Show Message Dialogノードを使う
eub ue5 blueprint dialog editor utility blueprint
パーティクルなんてプレイヤーが遠くなったらDeactivateしてしまえば軽量化なんてしなくても大体の場合、負荷のボトルネックにはならないみたい
BluePrint でActor選んで
ビューポートでNaiagaraを配置
SphereColiderを追加して半径を1250から1800に指定
コリジョン設定をOverlapAll
Begin OverlapでNaiagaraのVisibleとActivateしてついでにSet Relative Location 0,0,0
End OverlapでNaiagaraのVisibleとDeactivate
してしまえばNaiagaraがボトルネックになることは避けられる。
Particle Stateの
Kill Particles When Lifetime Has Elapsed
Loop Particles Life Time
Let Infinity Lived Particles Die When Emitter Deactives
ライフタイムが経過したときにパーティクルを殺す <あとからするとうまくいかない
ループ パーティクルの寿命 <意味不明
エミッタが非アクティブになったときに無限に生きたパーティクルを消滅させる <うまくいった。
音楽のランダムの歴史から言って
途切れなくランダムにする方法は理論から行くと長ければ長いほど途切れたと錯覚しやすいので長くする。
エミッタの更新の
Life Cycleは
loop Duration 60
パーティクルのスポーンのInitialize Particleの
lifetimeは
Random Rageにして
5から60の値の設定
関係ないが
Scale Mesh SIzeはパーティクルのスポーン時にMesh AttributeがUniformで1.0になってないと表示されなくなる。
完成したもの
HangingParticulatesで
これは自分の中でかなりおおきな発見だった。
Shading Modelを変更しなくても、透明で、ベースカラー、Metalic スペキュラ、ラフネス、エミッシブ、Normal、タンジェント、ワールド位置オフセット、ワールドディスプレースメント、テッセレーション乗数、アンビエントオクルージョン、屈折が使える
詳細は以下
https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Materials/HowTo/Transparency/
【UnrealEngine】水っぽいマテリアルを作ったときのメモ(屈折率)
https://qiita.com/nchhujimiyama/items/8d2c820f2a1367864569
他にも
import unreal
import codecs
import os
def my_makedirs(path):
if not os.path.isdir(path):
os.makedirs(path)
my_makedirs(SaveDir)
print("SaveDir= "+SaveDir)
print("FileName= "+FileName)
savePath=SaveDir+"/"+FileName+".tga"
print("savePath= "+savePath)
editorAssetLib = unreal.EditorAssetLibrary()
texture2d=editorAssetLib.load_asset(assetPath)
#canvasRenderTarget2D=editorAssetLib.load_asset(assetPath)
#texture2d=unreal.Texture2D(canvasRenderTarget2D)
print("texture2d= "+str(texture2d))
task = unreal.AssetExportTask()
task.set_editor_property('automated', True)
task.set_editor_property('filename', savePath)
task.set_editor_property('object', texture2d)
task.set_editor_property('prompt', False)
task.set_editor_property('exporter', unreal.TextureExporterTGA())
check = unreal.Exporter.run_asset_export_task(task)
if check==True:
pass
else:
print(u"tga イメージの生成に失敗しました")
/Game/ThirdPerson/Blueprints/
には
BP_ThirdPersonCharacter 1つしか入ってないわりに女かい。ってなる
(オーバーライドしてるのが女だから)
複製してBP_ThirdPersonCharacter_Quinn としておく
複製してBP_ThirdPersonCharacter_Manny としておく
メッシュは SKM_Manny_Simple
アニメーションBPは ABP_Manny
にしたものを
BP_ThirdPersonCharacter_Manny としておく。
これだけ、したら親のアニムBPのABP_Mannyをみていこう。
https://lunanelis.hatenablog.com/entry/2022/04/07/034505
イベントグラフは
ネリスさんの書いた通り
他にアニメ用フラグを追加したければここのSequenceにピン追加して書く。
AnimGraphは
上のLocomotionのっステートを=でつないでアニメーションをキャッシュしている。
(新規アニメーションのcacheで出せるノード)
IdleとWalk/Runをキャッシュしているってこと。
MainStateのLocomotionの中に入ってみるとキャッシュを使ってる。
あとはMainStateの説明だけどわかりやすく上のノードたち回した。
ToFallingとToLandの2つが新しくできたステーツエイリアスノード
このノードにくっついてる条件(⇔みたいなヤツ)を、設定したステート中に満たすとワープしてこれるというノード
To Fallingは LocomotionとLandのときにワープしてこれるみたい。
ToLandは JumpとFall Loop のときにワープしてこれるみたい。
で実際入ってくる条件はいつもどおり矢印に設定する感じ
コントロールリグの説明は
UE備忘録本舗さんの動画を見たほうが分かりやすかったよ
できたパッケージはこちらにアップしました。できたら遊んでみてください。
2.83GBあります。
download は以下
DevelopmentBuild チェックポイント(レベル内セーブ機能)があるEasyバージョン
V7 VoicePeak版
https://drive.google.com/file/d/1brxO2bYWV4GZfw9vMK6O_L6ReHHHTFow/view?usp=sharing
V4
https://drive.google.com/file/d/1S25uUMd1k9umFNJ8HRiXHf0QvtRGCTNR/view?usp=sharing
Shipping チェックポイント(レベル内セーブ機能)がないHardバージョン
V6 VoicePeak版
https://drive.google.com/file/d/1khzi3AEROpcaJhmpsGoMqxYDtxVVFj9U/view?usp=sharing
V2
https://drive.google.com/file/d/10s3s-XBcIw3ezOFC3qbgvrI82PXvzn2W/view?usp=sharing
操作方法
キーボードでの操作は以下
Jump スペースバー
スライディング C
弓構え 1
弓発射 マウス左クリック
このレ ベルをやり直し H
キャラクター変更 C
移動 WASD 後ろから敵に近づくと、はがいじめ
カメラ方向 マウス左クリックドラッグ
アイテム回収/構え時は投げ マウス左クリック
アイテム投げ構え マウス右クリック
ゲームパッドでの操作は以下
感想、コメントなどくれると泣いて喜びます。笑
https://www.comtec.daikin.co.jp/DC/event/202201-toranomaki-rig-sem.html
学んだこと。
1.パンチ、切り付けはパンチ後、軽反動つける
2.軽い武器には反動いらない
3.大剣は地面から押し返す力を受けて体が揺れ
4.力の伝わる順番はパンチ腰→胸→腕
5.パンチ腰の動き下→上→下をパーツごと
6.ヒット後で腰をさらにねじ込むと強くなる
7.腰を入れる、運動連鎖の法則
8.大剣は振り下ろすので腰も同じ動きをする
9.重いので振り下ろす時だけじゃない
10.人間の胴体は重いので1回バウンドのみ
11.人間には脳みそ揺らし過ぎない意識がある
12.大剣はヒット後に胸をねじ込むと強くなる
13.大剣はヒット後、腰に合わせ武器を後ろに
14.ダメージはヒット部位、腰→胸→頭で落ち
15.ダメージは意識がないので脳みそ揺らす
16.ダメージは顔をそむけたり不安定に。
17.バウンドのタイミングずらしてランダム感
UE4 ALS Punch
プロジェクト設定>インプット>アクションマッピング+で追加して
Attack に
・キーボードのR
・ゲームパッドのショルダーのRトリガー
を追加した
A2_CharactorBPで
イベントグラフの下に+で追加して
CharactorInputGraphを追加して
Attackのインプットアクションを配置
イベントグラフでカスタムイベントを追加
Attack_Eventと命名
CharactorInputGraphを追加して
Attackのインプットアクションから>Attack_Eventへつなぐ
使いたい攻撃モーションのアセットを右クリックして作成>AnimMontage
A2_F2_BigSwordSlash4_Montageができたので
CharacterBPで関数を作成して
GetAttackAnimationとリネーム
GetAttackAnimation>switch on ALS_OvarlayState
Get OverlayState >switch on ALS_OvarlayStateへ
switch on ALS_OvarlayStateのDefaultからReturnノードへつなぐ
Returnノードにoutputを追加してReturnValueにして
型をAnim Montageにし
CharacterBPで変数を作成してAttack_Animにした。
型をAnim Montageにした。
Get AttackAnimしてそのデフォルト値にA2_F2_BigSwordSlash4_Montageを追加した。
Get AttackAnimをReturnノードにつないだ
イベントグラフでGet Main Anim instanceして>値を検証済みGETに変更した
Attack_Event>Main Anim instanceとつなぐ。
Main Anim instance>Montage Playを呼ぶ
作った関数GetAttackAnimationを配置してpure純粋化>Montage Playへ接続
A2_F2_BigSwordSlash4から>EnableRootMotionをオンに
A2_F2_BigSwordSlash4_Montagから>スロット>スロット名>
MovementActionGroup BasedLayer
スケルトンにhand_rにhand_r_weaponソケットを追加
hand_r_weaponソケットにプレビューアセットを追加して角度調整
CharacterBPのビューでStatickMesh追加武器メッシュ設定して
一旦完成。
Code : return MyFunction(texCoord,resolution,R);
OutputType: Float4
Inputs : texCoord,resolution,R,B
IncludeFilePath:/Project/Ring.usf
// ring
float centerR= length(p);//その座標の中心からの距離 中心が1 まわり0
float gradationOffset=R-centerR; //グラデーションをずらす。
float ring= abs(gradationOffset); //中心から距離が 0.5 となる場所ほど値を小さく
float t = B/ring;//見た目が天使の輪に見えるように係数をかける
//Ring.usf
//return MyFunction(texCoord,resolution,R,B);
float4 MyFunction(float2 texCoord,float2 resolution,float R,float B)
{
// グラデーションのcenterをずらす
float2 p = (texCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);
// ring
float centerR= length(p);//その座標の中心からの距離 中心が1 まわり0
float gradationOffset=R-centerR; //グラデーションをずらす。
float ring= abs(gradationOffset); //中心から距離が 0.5 となる場所ほど値を小さく
float t = B/ring;//見た目が天使の輪に見えるように係数をかける
return float4(t,t,t, 1.0);;
}
参考
三平方の定理で円を色分け
Code: return MyFunction(texCoord,resolution,R,A,B);
OutputType:Float4
Inputs: texCoord,resolution,R,A,B
Input File Paths: /Project/Circle.usf
pow(V,2.0)でVの2乗って意味
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-pow
つかわないでみた。
float R2=p.x*p.x+p.y*p.y;//三平方の定理
//Circle.usf
//return MyFunction(texCoord,resolution,R,A,B);
float4 MyFunction(float2 texCoord,float2 resolution,float R,float4 A,float4 B)
{
float2 p = (texCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);
//return float3(p.x,p.y,1.0);
//float R=0.5;
//float4 c = float4(1.0,1.0,1.0,1.0);// baseColor
float4 c =A;// baseColor
float R2=p.x*p.x+p.y*p.y;//三平方の定理
//if(pow(p.x,2.0) + pow(p.y,2.0) <= R){
if(R2 <= R){
// c = float4(0.0,0.0,0.0,0.0); //circleColor
c = B;//circleColor
}
return c;
}
参考
失敗1、2020年になってCustomノードが安定してきたみたいで
constで宣言しておくとそのままMyFloat使える
Codeにreturn MyFloat;で使える。
CodeにMyreturn MyFunction();で関数を呼び出せる。
const static float3 MyFloat = float3(1.0,0.0,0.0);
float3 MyFunction()
{
return float3(0.0,1.0,0.0);
}
TestOutput1 = float3(0,0,1);
return 0.0;
Additional Output :TestOutput1
OutputType CMOT Float1
で
コンパイルされて自動生成されたHLSLコードの中身は
エラーコードで出てくるこれは
/Engine/Generated/Material.ush
マテリアルエディタのメニュー「ウインドウ>シェーダーコード>HLSL コード」を選択。
すると HLSL コードのウインドウが開き、コンパイルされた全マテリアルの内容が HLSL で表示される。
このプロジェクトの作り方は
【UE4】USF(Unreal Shader File) をすぐに始める環境設定 Project編さん
でのShaderフォルダの読み込み設定が必要だった。。50個ぐらいエラーがでるので見ない方がいいかも
今回はプロジェクト名は:Shader_MatCustomにしたよ
プロジェクト設定でCPP
Shader_MatCustom.h
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FShader_MatCustom : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
Shader_MatCustom.cpp
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Shader_MatCustom.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FShader_MatCustom, Shader_MatCustom, "Shader_MatCustom" );//3つの書き換え
void FShader_MatCustom::StartupModule()
{
FString ShaderDirectory = FPaths::Combine(FPaths::ProjectDir(), TEXT("Shader"));
if (!AllShaderSourceDirectoryMappings().Contains("/Project"))
{
AddShaderSourceDirectoryMapping("/Project", ShaderDirectory);
}
}
void FShader_MatCustom::ShutdownModule()
{
}
Shader_MatCustom.Build.cs
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class Shader_MatCustom : ModuleRules // ←クラス名リネーム
{
public Shader_MatCustom(ReadOnlyTargetRules Target) : base(Target) // ←クラス名リネーム
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { //改行して展開した。
"Core",
"CoreUObject",
"Engine",
"InputCore",
"RenderCore", // ←追記
"RHI" // ←あとで必要になるので追記(パス追加に関係ない)
});
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
VSでビルドをしてコンパイル
Shaderフォルダ作成
マテリアル作成
CustomNode作成
MyShader.usf作成
IncludeFilePathに/Project/MyShader.usf
MyShader.usf
const static float3 MyFloat = float3(1.0,0.0,0.0);
float3 MyFunction()
{
return float3(0.0,1.0,0.0);
}
やっとうまくいったので
C++サンプルプロジェクトは丸ごとだ。.slnも入ってるよ
https://drive.google.com/file/d/1-ClY_v2cudLARAkMmAfPGrAnFndNnWIX/view?usp=sharing
参照
キンアジさんのところで見つけてしまった。