本文整理汇总了C++中constructorhelpers::FObjectFinder类的典型用法代码示例。如果您正苦于以下问题:C++ FObjectFinder类的具体用法?C++ FObjectFinder怎么用?C++ FObjectFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FObjectFinder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:Amaterasu90,项目名称:Runner,代码行数:35,代码来源:MotherActor.cpp
示例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);
}
开发者ID:ArchDD,项目名称:Archs-HairyLab-UE4,代码行数:28,代码来源:HairSegment.cpp
示例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;
}
}
开发者ID:ChristopherMurray194,项目名称:Final_Project,代码行数:33,代码来源:Projectile.cpp
示例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;
}
开发者ID:mholtkamp,项目名称:bomber-rats,代码行数:31,代码来源:ExplodeRay.cpp
示例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);
}
开发者ID:jovoelcker,项目名称:SkateboardMocap,代码行数:28,代码来源:SkateboardPawn.cpp
示例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;
}
开发者ID:Dredfort,项目名称:TDown,代码行数:27,代码来源:HeatmapDataCollector.cpp
示例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));
}
}
开发者ID:ChristopherMurray194,项目名称:Final_Project,代码行数:26,代码来源:Rifle.cpp
示例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);
}
开发者ID:mister345,项目名称:WorkSamples,代码行数:31,代码来源:Particle.cpp
示例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;
}
开发者ID:Jinwei1,项目名称:AirSim,代码行数:8,代码来源:VehiclePawnWrapper.cpp
示例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;
}
}
开发者ID:belven,项目名称:Mech_RPG,代码行数:9,代码来源:ChannelledAbility.cpp
示例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;
}
开发者ID:Ali-Shery,项目名称:UE4_CodeTutorial_5,代码行数:58,代码来源:CollidingPawn.cpp
示例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;
}
}
开发者ID:horinoh,项目名称:UE4ParametricSurface,代码行数:10,代码来源:ParametricSurfaceComponent.cpp
示例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);
}
}
开发者ID:belven,项目名称:Mech_RPG,代码行数:12,代码来源:Weapon.cpp
示例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;
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:12,代码来源:PlayerHUD.cpp
示例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;
}
开发者ID:weelcheel,项目名称:Mythos-Realm,代码行数:14,代码来源:PlayerHUD.cpp
示例16: CollisionProfileName
AMechanism::AMechanism()
{
PrimaryActorTick.bCanEverTick = true;
//skeletal mesh
SkeletalMesh = CreateOptionalDefaultSubobject<USkeletalMeshComponent>(TEXT("SkeletalComponent"));
if (SkeletalMesh) {
SkeletalMesh->AlwaysLoadOnClient = true;
SkeletalMesh->AlwaysLoadOnServer = true;
SkeletalMesh->bOwnerNoSee = false;
SkeletalMesh->MeshComponentUpdateFlag = EMeshComponentUpdateFlag::AlwaysTickPose;
SkeletalMesh->bCastDynamicShadow = true;
SkeletalMesh->bAffectDynamicIndirectLighting = true;
SkeletalMesh->PrimaryComponentTick.TickGroup = TG_PrePhysics;
SkeletalMesh->bChartDistanceFactor = true;
SkeletalMesh->AttachParent = RootComponent;
static FName CollisionProfileName(TEXT("OverlapAll"));
SkeletalMesh->SetCollisionProfileName(CollisionProfileName);
SkeletalMesh->bGenerateOverlapEvents = true;
SkeletalMesh->bCanEverAffectNavigation = false;
SkeletalMesh->SetRelativeLocation(FVector(0, 0, 0));
SkeletalMesh->CastShadow = false;
}
//Public properties
CanActivate = CanDisactivate = true;
DisableAtEndAction = false;
NumberOfActions = 1;
TimeInIntermittence = 1.0f;
TimeToStartIntermittence = 5.0f;
ColorDisabled = FLinearColor(0.0f, 0.0f, 0.0f, 1.0f);
ColorEnabled = FLinearColor(0.0f, 0.9490f, 1.0f, 1.0f);
intermitedOn = true;
m_target = ColorEnabled;
m_origin = ColorDisabled;
//Private properties
m_elapsedIntermitence = 0.0f;
m_elapsedStartIntermitence = TimeToStartIntermittence;
MechanismMaterial = ((UPrimitiveComponent*)GetRootComponent())->CreateAndSetMaterialInstanceDynamic(0);
UMaterial* mat = nullptr;
static ConstructorHelpers::FObjectFinder<UMaterial> MatFinder(TEXT("Material'/Game/Models/Button/Button.Button'"));
if (MatFinder.Succeeded())
{
mat = MatFinder.Object;
MechanismMaterial = UMaterialInstanceDynamic::Create(mat, GetWorld());
}
m_isPushed = false;
}
开发者ID:alfreSosa,项目名称:PC-TowardsTheLight,代码行数:49,代码来源:Mechanism.cpp
示例17: ofMesh
ARangePowerup::ARangePowerup()
{
static ConstructorHelpers::FObjectFinder<UStaticMesh> ofMesh(TEXT("StaticMesh'/Game/StaticMeshes/explode_powerup.explode_powerup'"));
m_pMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
m_pMesh->SetCollisionProfileName(TEXT("NoCollision"));
if (ofMesh.Succeeded())
{
m_pMesh->SetStaticMesh(ofMesh.Object);
m_pMesh->SetWorldScale3D(FVector(0.5f, 0.5f, 0.5f));
}
m_pMesh->AttachTo(RootComponent);
}
开发者ID:mholtkamp,项目名称:bomber-rats,代码行数:15,代码来源:RangePowerup.cpp
示例18: SphereVisualAsset
// Sets default values
APawnCharacter::APawnCharacter()
{
// Stats
moveSpeed = 300.0f;
dodgeSpeed = 800.0f;
// 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;
// Our root component will be a sphere that reacts to physics
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(40.0f);
SphereComponent->SetCollisionProfileName(TEXT("Pawn"));
// Create and position a mesh component so we can see where our sphere is
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));
}
// Use a spring arm to give the camera smooth, natural-feeling motion.
USpringArmComponent* SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraAttachmentArm"));
SpringArm->AttachTo(RootComponent);
SpringArm->RelativeRotation = FRotator(-75.f, 0.f, 0.f);
SpringArm->TargetArmLength = 800.0f;
SpringArm->bEnableCameraLag = true;
SpringArm->CameraLagSpeed = 5.0f;
// Create a camera and attach to our spring arm
UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("ActualCamera"));
Camera->AttachTo(SpringArm, USpringArmComponent::SocketName);
// Take control of the default player
AutoPossessPlayer = EAutoReceiveInput::Player0;
// Create an instance of our movement component, and tell it to update the root.
OurMovementComponent = CreateDefaultSubobject<UPawnCharacterMovementComponent>(TEXT("CustomMovementComponent"));
OurMovementComponent->UpdatedComponent = RootComponent;
OurMovementComponent->setMoveSpeed(moveSpeed);
}
开发者ID:EliseSpPrj,项目名称:Descend,代码行数:49,代码来源:PawnCharacter.cpp
示例19: FLinearColor
// Sets default values
AAltar::AAltar()
{
PrimaryActorTick.bCanEverTick = true;
this->SetActorEnableCollision(true);
GiveKey = true;
AltarColor = FLinearColor(0.0f, 0.0f, 1.0f);
DisableColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
AltarMaterial = ((UPrimitiveComponent*)GetRootComponent())->CreateAndSetMaterialInstanceDynamic(0);
UMaterial* mat = nullptr;
static ConstructorHelpers::FObjectFinder<UMaterial> MatFinder(TEXT("Material'/Game/Models/Altar/Altar_mat.Altar_mat'"));
if (MatFinder.Succeeded())
{
mat = MatFinder.Object;
AltarMaterial = UMaterialInstanceDynamic::Create(mat, GetWorld());
}
m_colorControl = false;
}
开发者ID:alfreSosa,项目名称:PC-TowardsTheLight,代码行数:18,代码来源:Altar.cpp
示例20: FRotator
ATP_TopDownCharacter::ATP_TopDownCharacter()
{
// Set size for player capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// Don't rotate character to camera direction
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Rotate character to moving direction
GetCharacterMovement()->RotationRate = FRotator(0.f, 640.f, 0.f);
GetCharacterMovement()->bConstrainToPlane = true;
GetCharacterMovement()->bSnapToPlaneAtStart = true;
// Create a camera boom...
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->SetupAttachment(RootComponent);
CameraBoom->bAbsoluteRotation = true; // Don't want arm to rotate when character does
CameraBoom->TargetArmLength = 800.f;
CameraBoom->RelativeRotation = FRotator(-60.f, 0.f, 0.f);
CameraBoom->bDoCollisionTest = false; // Don't want to pull camera in when it collides with level
// Create a camera...
TopDownCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("TopDownCamera"));
TopDownCameraComponent->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
TopDownCameraComponent->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
// Create a decal in the world to show the cursor's location
CursorToWorld = CreateDefaultSubobject<UDecalComponent>("CursorToWorld");
CursorToWorld->SetupAttachment(RootComponent);
static ConstructorHelpers::FObjectFinder<UMaterial> DecalMaterialAsset(TEXT("Material'/Game/TopDownCPP/Blueprints/M_Cursor_Decal.M_Cursor_Decal'"));
if (DecalMaterialAsset.Succeeded())
{
CursorToWorld->SetDecalMaterial(DecalMaterialAsset.Object);
}
CursorToWorld->DecalSize = FVector(16.0f, 32.0f, 32.0f);
CursorToWorld->SetRelativeRotation(FRotator(90.0f, 0.0f, 0.0f).Quaternion());
// Activate ticking in order to update the cursor every frame.
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,代码来源:TP_TopDownCharacter.cpp
注:本文中的constructorhelpers::FObjectFinder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论