本文整理汇总了C++中constructorhelpers::FObjectFinder类的典型用法代码示例。如果您正苦于以下问题:C++ FObjectFinder类的具体用法?C++ FObjectFinder怎么用?C++ FObjectFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FObjectFinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FVector
// Sets default values
AMotherActor::AMotherActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
UBoxComponent* Box = CreateDefaultSubobject<UBoxComponent>(TEXT("RootComponent"));
RootComponent = Box;
Box->InitBoxExtent(FVector(20.0f, 20.0f, 20.0f));
UBoxComponent* Box1 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
Box1->InitBoxExtent(FVector(60.0f, 60.0f, 60.0f));
Box1->RelativeLocation = FVector(100.0f, 0.0f, 0.0f);
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere"));
SphereComponent->InitSphereRadius(60.0f);
SphereComponent->RelativeLocation = FVector(100.0f, 0.0f, 0.0f);
UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded()) {
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(0.0f, 0.0f, -100.0f));
SphereVisual->SetWorldScale3D(FVector(0.8f));
}
Box1->AttachTo(RootComponent);
SphereVisual->AttachTo(RootComponent);
SphereComponent->AttachTo(RootComponent);
UChildActorComponent * ChildActor = CreateDefaultSubobject<UChildActorComponent>(TEXT("InventoryCamera"));
ChildActor->SetChildActorClass(AOrbitalActor::StaticClass());
ChildActor->CreateChildActor();
FVector position = GetActorLocation();
ChildActor->SetRelativeTransform(FTransform(position));
}
示例2: BasicMat
// Sets default values
AHairSegment::AHairSegment()
{
PrimaryActorTick.bCanEverTick = false;
ProceduralMeshData = NewObject<UProceduralMeshData>();
ProceduralMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
RootComponent = ProceduralMesh;
ProceduralMesh->SetCollisionProfileName(TEXT("OverlapAll"));
OutlineMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("OutlineMesh"));
static ConstructorHelpers::FObjectFinder<UMaterialInterface> BasicMat(TEXT("MaterialInterface'/Game/Materials/M_Basic.M_Basic'"));
if (BasicMat.Succeeded())
OutlineMesh->SetMaterial(0, BasicMat.Object);
OutlineMesh->SetRenderInMainPass(false);
OutlineMesh->SetCastShadow(false);
Spline = CreateDefaultSubobject<USplineComponent>(TEXT("Spline"));
Spline->SetupAttachment(RootComponent);
Spline->ClearSplinePoints();
static ConstructorHelpers::FObjectFinder<UMaterialInterface> TmpMat(TEXT("MaterialInterface'/Game/Materials/M_Test.M_Test'"));
if (TmpMat.Succeeded())
Material = TmpMat.Object;
if (Material)
SetSegmentMaterial(0, Material);
}
示例3: SphereVisualAsset
// Sets default values
AProjectile::AProjectile()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("Collision_Component"));
CollisionComp->SetSphereRadius(5.0f);
CollisionComp->AttachTo(RootComponent);
CollisionComp->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
CollisionComp->SetCollisionObjectType(ECollisionChannel::ECC_WorldDynamic);
SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Sphere_Mesh"));
SphereVisual->AttachTo(CollisionComp);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(-7.0f, 0.0f, 0.0f));
SphereVisual->SetWorldScale3D(FVector(0.2f, 0.04f, 0.02f));
SphereVisual->SetCollisionEnabled(ECollisionEnabled::NoCollision);
static ConstructorHelpers::FObjectFinder<UMaterial> MaterialAsset(TEXT("/Game/Materials/BulletMat"));
if (MaterialAsset.Succeeded())
{
SphereVisual->SetMaterial(0, MaterialAsset.Object);
}
UProjectileMovementComponent* ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile_Movement"));
ProjectileMovement->InitialSpeed = 2000.0f;
ProjectileMovement->ProjectileGravityScale = 0.0f;
}
}
示例4: ofMesh
// Sets default values
AExplodeRay::AExplodeRay()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Find assets
static ConstructorHelpers::FObjectFinder<UStaticMesh> ofMesh(TEXT("StaticMesh'/Game/StaticMeshes/Shape_Cube.Shape_Cube'"));
static ConstructorHelpers::FObjectFinder<UMaterial> ofMat(TEXT("Material'/Game/Materials/M_Ray.M_Ray'"));
m_pMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
m_pMesh->SetCollisionProfileName(TEXT("NoCollision"));
if (ofMesh.Succeeded() &&
ofMat.Succeeded())
{
m_pMesh->SetStaticMesh(ofMesh.Object);
m_pMesh->SetRelativeLocation(FVector(0.0f, 0.0f, -50.0f));
m_pParentMat = ofMat.Object;
}
m_pBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
m_pBox->InitBoxExtent(FVector(50.0f, 50.0f, 50.0f));
m_pBox->SetCollisionProfileName(TEXT("OverlapAll"));
m_pBox->SetCollisionResponseToChannel(ECollisionChannel::ECC_GameTraceChannel1, ECollisionResponse::ECR_Ignore);
RootComponent = m_pBox;
m_pMesh->AttachTo(RootComponent);
m_fTime = EXPLODE_RAY_LIFETIME;
}
示例5:
// Sets default values
ASkateboardPawn::ASkateboardPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Makes the first player take control of this pawn automatically
AutoPossessPlayer = EAutoReceiveInput::Player0;
// Create a dummy root component we can attach things to
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
// Create a camera and a visible object
UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComponent"));
static ConstructorHelpers::FObjectFinder<UStaticMesh>CubeVisualAsset(TEXT("/Game/skateboard"));
if (CubeVisualAsset.Succeeded())
{
Mesh->SetStaticMesh(CubeVisualAsset.Object);
Mesh->SetSimulatePhysics(true);
//Mesh->SetMassOverrideInKg("", 100);
}
// Attach our camera and visible object to our root component. Offset and rotate the camera.
Camera->AttachTo(Mesh);
Camera->SetRelativeLocation(FVector(-450.0f, 0.0f, 450.0f));
Camera->SetRelativeRotation(FRotator(-45.0f, 0.0f, 0.0f));
Camera->SetWorldScale3D(FVector(1, 1, 1));
Mesh->AttachTo(RootComponent);
}
示例6: TEXT
// Sets default values
AHeatmapDataCollector::AHeatmapDataCollector(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
FString StringOfCoords = "";
it = 0;
Billboard = ObjectInitializer.CreateDefaultSubobject<UBillboardComponent>(this, TEXT("Billboard"));
RootComponent = Billboard;
static ConstructorHelpers::FObjectFinder<UTexture2D> Spalsh(TEXT("Texture2D'/Engine/EditorResources/S_NavP.S_NavP'"));
if (Spalsh.Succeeded())
{
Billboard->SetSprite(Spalsh.Object);
}
TextComponent = ObjectInitializer.CreateDefaultSubobject<UTextRenderComponent>(this, TEXT("TextComponent"));
TextComponent->AttachTo(RootComponent);
TextComponent->WorldSize = 92;
TextComponent->bHiddenInGame = false;
PathSpline = ObjectInitializer.CreateDefaultSubobject<USplineComponent>(this, TEXT("PathSplineComponent"));
BeamParticle = ObjectInitializer.CreateDefaultSubobject<UParticleSystem>(this, TEXT("beamParticle"));
//BeamParticle->bAutoDeactivate = false;
}
示例7: GunAsset
// Sets default values
ARifle::ARifle()
{
// Max ammo in one clip
ClipSize = 30;
// Ammo per clip/magazine
AmmoCount = ClipSize;
// Rounds per second
SetRPS(10.0f);
// Range of rifle
SetRange(2000.0f);
// Damage values
SetPlayerDamage(0.5f);
SetEnemyDamage(20.0f);
static ConstructorHelpers::FObjectFinder<USkeletalMesh> GunAsset(TEXT("/Game/FPWeapon/Mesh/SK_FPGun.SK_FPGun"));
if (GunAsset.Succeeded())
{
static ConstructorHelpers::FObjectFinder<UMaterial> MaterialAsset(TEXT("/Game/FPWeapon/Materials/M_FPGun"));
if (MaterialAsset.Succeeded())
{
SetupWeaponMesh(GunAsset.Object, MaterialAsset.Object, FVector(0.0f, 0.0f, 0.0f), FRotator(0.0f, -90.0f, 0.0f));
}
SetupArrowComp(FVector(0.0f, 50.0f, 11.0f), FRotator(0.0f, 90.0f, 0.0f));
}
}
示例8: SphereVisualAsset
AParticle::AParticle()
:
m_bobHeight( 50.f ),
m_sphereRadius(0.009f),
m_lightIntensity(50.f)
{
// Must turn on for floating animation
PrimaryActorTick.bCanEverTick = false;
// Set visual sphere as the root component
SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("RootComponent"));
RootComponent = SphereVisual;
// NOTE - Shape_Sphere.uasset must be located in the following directory at compile time (will be automatically created for projects with starter content)
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
// Otherwise, the Shape_Sphere.uasset file must be physically located in the project's "Content" folder at compile time for it to show up
//static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetWorldScale3D(FVector(m_sphereRadius));
}
// Create and attach point light
PointLight1 = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLight1"));
PointLight1->Intensity = m_lightIntensity;
PointLight1->bVisible = true;
PointLight1->SetupAttachment(SphereVisual);
}
示例9:
VehiclePawnWrapper::VehiclePawnWrapper()
{
static ConstructorHelpers::FObjectFinder<UParticleSystem> collision_display(TEXT("ParticleSystem'/AirSim/StarterContent/Particles/P_Explosion.P_Explosion'"));
if (!collision_display.Succeeded())
collision_display_template = collision_display.Object;
else
collision_display_template = nullptr;
}
示例10: Super
UChannelledAbility::UChannelledAbility() : Super() {
partclSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("ChannelLineParticleSystem"));
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleSystemClass(TEXT("/Game/TopDown/Particle_Effects/AoE"));
if (ParticleSystemClass.Succeeded()) {
partclSystem->Template = ParticleSystemClass.Object;
partclSystem->bAutoActivate = false;
}
}
示例11: SphereVisualAsset
// Sets default values
ACollidingPawn::ACollidingPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Tutorial code
// Our root component will be a sphere that reats to Physics
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(40.0f);
SphereComponent->SetCollisionProfileName(TEXT("Pawn"));
// Creating and correctly Positioning the Mesh component so that it fits the sphere collision
UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
SphereVisual->AttachTo(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(0.0f, 0.0f,-40.0f));
SphereVisual->SetWorldScale3D(FVector(0.8f));
}
// Particle system Creation, Positioning (Offset)
OurParticleSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("MovementParticles"));
OurParticleSystem->AttachTo(SphereVisual);
OurParticleSystem->bAutoActivate = false;
OurParticleSystem->SetRelativeLocation(FVector(-20.0f,0.0f,0.0f));
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleAsset(TEXT("/Game/StarterContent/Particles/P_Fire.P_Fire"));
if (ParticleAsset.Succeeded())
{
OurParticleSystem->SetTemplate(ParticleAsset.Object);
}
// SpringArm creation for a smooth and fast Camera Experience ( We could have just avoided this springArm ) but for the sake of smoothness
USpringArmComponent* SpringArm = CreateAbstractDefaultSubobject<USpringArmComponent>(TEXT("CameraAttachmentArm"));
SpringArm->AttachTo(RootComponent);
SpringArm->RelativeRotation = FRotator(-45.0f,0.0f,0.0f);
SpringArm->TargetArmLength = 400.0f;
SpringArm->bEnableCameraLag = true;
SpringArm->CameraLagSpeed = 3.0f;
// Easy to create the Camera component and attach it to the built in Socket at the end of springArm
UCameraComponent* ActualCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("ActualCamera"));
ActualCamera->AttachTo(SpringArm, USpringArmComponent::SocketName);
// Take control of the default player
AutoPossessPlayer = EAutoReceiveInput::Player0;
// creating an instance of our movement component, and telling it to update the root.
OurMovementComponent = CreateDefaultSubobject<UCollidingPawnMovementComponent>(TEXT("CustomMovementComponent"));
OurMovementComponent->UpdatedComponent = RootComponent;
}
示例12: Super
UParametricSurfaceComponent::UParametricSurfaceComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, MaterialInterface(nullptr)
{
static ConstructorHelpers::FObjectFinder<UMaterialInterface> MI(TEXT("MaterialInstanceConstant'/Game/Materials/M_Simple_Inst.M_Simple_Inst'"));
if (MI.Succeeded())
{
MaterialInterface = MI.Object;
}
}
示例13: Super
AWeapon::AWeapon() : Super() {
partclSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("WeaponParticle"));
audioComp = CreateDefaultSubobject<UAudioComponent>(TEXT("WeaponAudio"));
SetType(ItemEnumns::Weapon);
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleSystemClass(TEXT("/Game/TopDown/Particle_Effects/Gun_Flash"));
if (ParticleSystemClass.Succeeded()) {
partclSystem->Template = ParticleSystemClass.Object;
partclSystem->bAutoActivate = false;
partclSystem->SetActorParameter(FName(TEXT("BeamSource")), this);
}
}
示例14: Super
APlayerHUD::APlayerHUD(const FObjectInitializer& objectInitializer)
: Super(objectInitializer)
{
//Font'/Game/Realm/UI/UIFont.UIFont'
static ConstructorHelpers::FObjectFinder<UFont> fontClass(TEXT("/Game/Realm/UI/UIFont"));
if (fontClass.Succeeded())
{
uiFont = fontClass.Object;
}
bShowOverlays = true;
}
示例15: Super
APlayerHUD::APlayerHUD(const FObjectInitializer& objectInitializer)
: Super(objectInitializer)
{
//Font'/Game/Realm/UI/UIFont.UIFont'
static ConstructorHelpers::FObjectFinder<UFont> fontClass(TEXT("/Game/Realm/UI/UIFont"));
if (fontClass.Succeeded())
{
uiFont = fontClass.Object;
}
bShowOverlays = true;
mapPosition = FVector2D(0.8f, 0.7f);
mapDimensions = 300.f;
}