UDN
Search public documentation:
DevelopmentKitGemsAddingSpritesMeshesParticleEffectsJP
English Translation
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
Unreal Development Kit ホーム > Unreal Development Kit Gems > スプライト、メッシュ、パーティクルエフェクトをアクタに追加する方法
スプライト、メッシュ、パーティクルエフェクトをアクタに追加する方法
2011年3月に UDK について最終テスト実施済み
PC および iOS 対応
概要
関連テーマ
UnrealScript による方法
デフォルトのプロパティ
UnrealScript 内で、デフォルトのプロパティに静的メッシュのサブオブジェクトを追加する方法について説明します。 まず、クラス グローバル変数リスト内で、静的メッシュ コンポーネントの変数を宣言します。これによって、クラスが、デフォルトのプロパティ内で定義された静的メッシュ コンポーネントへの参照をもてるようになります。 デフォルトのプロパティ内で、サブオブジェクトを作成します。デフォルトのプロパティ内でサブオブジェクトを作成したら、アクタ内のコンポーネント配列に追加します。サブ オブジェクトは、そのすべてがコンポーネント配列に追加されなければ、使用することができません。class MyActor extends Actor; // Expose to Unrealscript and Unreal Editor var() StaticMeshComponent StaticMesh; defaultproperties { // Declare sub object Begin Object Class=StaticMeshComponent Name=MyStaticMeshComponent StaticMesh=StaticMesh'EditorMeshes.TexPropPlane' End Object StaticMesh=MyStaticMeshComponent Components.Add(MyStaticMeshComponent) }
class MySubActor extends MyActor; defaultproperties { // Redefine sub object Begin Object Name=MyStaticMeshComponent StaticMesh=StaticMesh'EngineMeshes.Cube' End Object StaticMesh=MyStaticMeshComponent Components.Add(MyStaticMeshComponent) }
class MySubActor extends MyActor; defaultproperties { Components.Remove(MyStaticMeshComponent) // Remove a specific actor component Components.Empty // Remove all actor components }
実行時
実行時にUnrealScript を使用して静的メッシュのコンポーネントを追加する方法について説明します。PostBeginPlay だけではなく、あらゆる関数に追加することが可能です。アクタのコンポーネントを初期化するか、他のプロパティをセットアップしなければならない場合があります。class MyActor extends Actor; var() StaticMeshComponent StaticMesh; function PostBeginPlay() { Super.PostBeginPlay(); StaticMesh = new () class'StaticMeshComponent'; if (StaticMesh != None) { StaticMesh.SetStaticMesh(StaticMesh'EngineMeshes.Cube'); AttachComponent(StaticMesh); } } defaultproperties { }
関連テーマ
「Unreal」エディタによる方法
class DynamicActorComponent extends Actor ClassGroup(Common) AutoExpandCategories(DynamicActorComponent) placeable; // Expose to Unrealscript and Unreal Editor var() const EditInline Instanced array<PrimitiveComponent> PrimitiveComponents; function PostBeginPlay() { local int i; // Check the primitive components array to see if we need to add any components into the components array. if (PrimitiveComponents.Length > 0) { for (i = 0; i < PrimitiveComponents.Length; ++i) { if (PrimitiveComponents[i] != None) { AttachComponent(PrimitiveComponents[i]); } } } Super.PostBeginPlay(); } defaultproperties { Begin Object Class=SpriteComponent Name=Sprite Sprite=Texture2D'EditorResources.S_Actor' HiddenGame=True AlwaysLoadOnClient=False AlwaysLoadOnServer=False End Object Components.Add(Sprite) }
DynamicActorComponent 配列の使用
コンテンツブラウザを開き、[Actor Classes] (アクタクラス) タブをクリックします。新たな DynamicActorComponent (動的アクタコンポーネント) が Common (一般) グループにあります。それを選択します。









ダウンロード
- 以上のサンプルで使用したコンテンツは、 ここ からダウンロードすることができます。 (DynamicActorComponents.zip)