本文整理汇总了C++中UStaticMeshComponent::SetWorldScale3D方法的典型用法代码示例。如果您正苦于以下问题:C++ UStaticMeshComponent::SetWorldScale3D方法的具体用法?C++ UStaticMeshComponent::SetWorldScale3D怎么用?C++ UStaticMeshComponent::SetWorldScale3D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UStaticMeshComponent
的用法示例。
在下文中一共展示了UStaticMeshComponent::SetWorldScale3D方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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);
}
示例4: SphereVisualAsset
// Sets default values
APawnWithCamera::APawnWithCamera()
{
// 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));
}
//Create our camera sprinf
OurCameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraSpringArm"));
OurCameraSpringArm->AttachTo(RootComponent);
OurCameraSpringArm->SetRelativeLocationAndRotation(FVector(4.0f, 0.0f, 30.0f), FRotator(-60.0f, 0.0f, 0.0f));
OurCameraSpringArm->TargetArmLength = 300.f;
OurCameraSpringArm->bEnableCameraLag = true;
OurCameraSpringArm->CameraLagSpeed = 3.0f;
OurCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("GameCamera"));
OurCamera->AttachTo(OurCameraSpringArm, USpringArmComponent::SocketName);
OurMovementComponent = CreateDefaultSubobject<UCollidingPawnMovementComponent>(TEXT("CustomMovementComponent"));
OurMovementComponent->UpdatedComponent = RootComponent;
//Take control of the default Player
AutoPossessPlayer = EAutoReceiveInput::Player0;
speenIncrease = 2.0f;
speed = 100.f;
}
示例5: FuselageVisualAsset
// Sets default values
AMyDrone::AMyDrone()
{
// 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;
// Our root component will be a sphere that reacts to physics
SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(20.0f);
SphereComponent->BodyInstance.SetCollisionEnabled(ECollisionEnabled::QueryOnly);
SphereComponent->BodyInstance.SetResponseToAllChannels(ECR_Overlap);
OnActorBeginOverlap.AddDynamic(this, &AMyDrone::OnOverlapBegin);
// Create and position a mesh component to fuselage
UStaticMeshComponent* fuselageMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
fuselageMesh->AttachTo(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> FuselageVisualAsset(TEXT("/Game/unreal_fuselage.unreal_fuselage"));
if (FuselageVisualAsset.Succeeded())
{
fuselageMesh->SetStaticMesh(FuselageVisualAsset.Object);
fuselageMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f)); // no translation for now
fuselageMesh->SetWorldScale3D(FVector(1.0f)); // no scaling for now
}
// find elevon in assets library
static ConstructorHelpers::FObjectFinder<UStaticMesh> ElevonVisualAsset(TEXT("/Game/elevon.elevon"));
// Create and position a mesh component to elevon 1
elevon1Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Elevon1Mesh"));
elevon1Mesh->AttachTo(RootComponent);
if (ElevonVisualAsset.Succeeded())
{
elevon1Mesh->SetStaticMesh(ElevonVisualAsset.Object);
elevon1Mesh->SetRelativeLocation(FVector(-12.0f, 12.0f, 0.0f)); // no translation for now
elevon1Mesh->SetWorldScale3D(FVector(1.0f)); // no scaling for now
}
// Create and position a mesh component to elevon 2
elevon2Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Elevon2Mesh"));
elevon2Mesh->AttachTo(RootComponent);
if (ElevonVisualAsset.Succeeded())
{
elevon2Mesh->SetStaticMesh(ElevonVisualAsset.Object);
elevon2Mesh->SetRelativeLocation(FVector(-12.0f, -12.0f, 0.0f)); // no translation for now
elevon2Mesh->SetWorldScale3D(FVector(1.0f)); // no scaling for now
}
// Create a particle system that we can activate or deactivate
DroneParticleSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("MovementParticles"));
DroneParticleSystem->AttachTo(fuselageMesh);
DroneParticleSystem->bAutoActivate = false;
DroneParticleSystem->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleAsset(TEXT("/Game/StarterContent/Particles/P_Fire.P_Fire"));
if (ParticleAsset.Succeeded())
{
DroneParticleSystem->SetTemplate(ParticleAsset.Object);
}
// inyit cvs table handlers
UCurveTable* expTable;
static ConstructorHelpers::FObjectFinder<UCurveTable>
expTable_BP(TEXT("CurveTable'/Game/Data/testtable.testtable'"));
expTable = expTable_BP.Object;
// not sure what this is, but it seems necessary
static const FString ContextString(TEXT("GENERAL"));
// here we link curves to experimental position CSV data
curveX = expTable->FindCurve(*FString::Printf(TEXT("X")), ContextString);
curveY = expTable->FindCurve(*FString::Printf(TEXT("Y")), ContextString);
curveZ = expTable->FindCurve(*FString::Printf(TEXT("Z")), ContextString);
// here we link curves to experimental quaternion CSV data
curveQ0 = expTable->FindCurve(*FString::Printf(TEXT("Q0")), ContextString);
curveQ1 = expTable->FindCurve(*FString::Printf(TEXT("Q1")), ContextString);
curveQ2 = expTable->FindCurve(*FString::Printf(TEXT("Q2")), ContextString);
curveQ3 = expTable->FindCurve(*FString::Printf(TEXT("Q3")), ContextString);
// here we link curves to experimental elevon CSV data
curveD1 = expTable->FindCurve(*FString::Printf(TEXT("D1")), ContextString);
curveD2 = expTable->FindCurve(*FString::Printf(TEXT("D2")), ContextString);
}