本文整理汇总了C++中FRotator函数的典型用法代码示例。如果您正苦于以下问题:C++ FRotator函数的具体用法?C++ FRotator怎么用?C++ FRotator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FRotator函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FVector
void AMyProjectBlockGrid::BeginPlay()
{
Super::BeginPlay();
// Number of blocks
const int32 NumBlocks = Size * Size;
// Loop to spawn each block
for(int32 BlockIndex=0; BlockIndex<NumBlocks; BlockIndex++)
{
const float XOffset = (BlockIndex/Size) * BlockSpacing; // Divide by dimension
const float YOffset = (BlockIndex%Size) * BlockSpacing; // Modulo gives remainder
// Make postion vector, offset from Grid location
const FVector BlockLocation = FVector(XOffset, YOffset, 0.f) + GetActorLocation();
// Spawn a block
AMyProjectBlock* NewBlock = GetWorld()->SpawnActor<AMyProjectBlock>(BlockLocation, FRotator(0,0,0));
// Tell the block about its owner
if(NewBlock != NULL)
{
NewBlock->OwningGrid = this;
}
}
}
示例2: FQuat
void FSimpleHMD::SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView)
{
InView.BaseHmdOrientation = FQuat(FRotator(0.0f,0.0f,0.0f));
InView.BaseHmdLocation = FVector(0.f);
// WorldToMetersScale = InView.WorldToMetersScale;
InViewFamily.bUseSeparateRenderTarget = false;
}
示例3: FQuat
FRotator UKismetMathLibrary::ComposeRotators(FRotator A, FRotator B)
{
FQuat AQuat = FQuat(A);
FQuat BQuat = FQuat(B);
return FRotator(BQuat*AQuat);
}
示例4: Tick
// Called every frame
void APilotPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//InputComponent->GetAxisValue("HandX");
Hand_move_dirvec.X = 3;
if (InputComponent)
{
//InputComponent->GetAxisValue("HandX");
Hand_move_dirvec.X = InputComponent->GetAxisValue("HandX");
Hand_move_dirvec.Y = InputComponent->GetAxisValue("HandY");
Hand_move_dirvec.Z = InputComponent->GetAxisValue("HandZ");
InputComponent->GetAxisValue("RightGrasp") > 0 ? RightHand->MakeGrabAvailable() : RightHand->MakeGrabUnable();
InputComponent->GetAxisValue("LeftGrasp") > 0 ? LeftHand->MakeGrabAvailable() : LeftHand->MakeGrabUnable();
InputComponent->GetAxisValue("LeftSecondaryGrasp") > 0 ? LeftHand->MakeSecondaryGraspAvailable() : LeftHand->MakeSecondaryGraspUnable();
InputComponent->GetAxisValue("RightSecondaryGrasp") > 0 ? RightHand->MakeSecondaryGraspAvailable() : RightHand->MakeSecondaryGraspUnable();
}
else
Hand_move_dirvec.X = 30000;
//Hand_move_dirvec /= (float)Hand_move_dirvec.Size();
RightArm->SetRelativeLocation(FirstPersonCameraComponent->RelativeLocation + RelativeArmposition);
LeftArm->SetRelativeLocation(FirstPersonCameraComponent->RelativeLocation + RelativeArmposition);
LeftRealHandScene->AddLocalOffset(FVector(InputComponent->GetAxisValue("LeftHandX"), InputComponent->GetAxisValue("LeftHandY"), InputComponent->GetAxisValue("LeftHandZ")));
RightRealHandScene->AddLocalOffset(Hand_move_dirvec * 1);
FirstPersonCameraComponent->AddRelativeRotation(FRotator(-InputComponent->GetAxisValue("YaxisLook"), InputComponent->GetAxisValue("XaxisLook"), 0));
}
示例5: FRotator
void ABrainNormalInteractiveObject::Tick(float deltaTime)
{
Super::Tick(deltaTime);
if (_canBeRotate)
{
_currentRotation += (_deltaRotation * (deltaTime / _animDuration));
_durationRotation += deltaTime;
if (_durationRotation > _animDuration)
{
_currentRotation = _targetRotation;
_deltaRotation = FRotator(0, 0, 0); // Annulation du deltaRotation
}
SetActorRotation(_currentRotation);
}
if (_canBeTranslate)
{
_currentTranslation += (_deltaTranslation * deltaTime / _animDuration);
_durationTranslation += deltaTime;
if (_durationTranslation > _animDuration)
{
_currentTranslation = _targetTranslation;
_deltaTranslation = FVector(0, 0, 0); // Annulation du deltaSize
}
SetActorLocation(_currentTranslation,true);
}
if (_canBeScale)
{
_currentScale += (_deltaScale * deltaTime / _animDuration);
_durationScale += deltaTime;
if (_durationScale > _animDuration)
{
_currentScale = _targetScale;
_deltaScale = FVector(0,0,0); // Annulation du deltaSize
}
SetActorScale3D(_currentScale);
}
if (_canBeShear)
{
_currentShearFirstAxis += (_deltaShearFirstAxis * deltaTime / _animDuration);
_currentShearSecondAxis += (_deltaShearSecondAxis * deltaTime / _animDuration);
_durationShear += deltaTime;
if (_durationShear > _animDuration)
{
_currentShearFirstAxis = _targetShearFirstAxis;
_currentShearSecondAxis = _targetShearSecondAxis;
_deltaShearFirstAxis = 0;
_deltaShearSecondAxis = 0;
}
FTransform sTrans = FTransform(Shear(_currentShearFirstAxis, _currentShearSecondAxis));
SetActorTransform(sTrans*_cachedTransform);
}
}
示例6: GetActorLocation
// Called every frame
void AGem::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
CollectionParticles->SetColorParameter("ParticleColor", GemColor);
CollectionParticles->SetRelativeLocation(FVector::ZeroVector);
CollectionParticles->SetWorldRotation(FRotator::ZeroRotator);
CollectionParticles->SetWorldScale3D(FVector(1.0f, 1.0f, 1.0f));
//CollectionParticles->UpdateInstances();
FVector loc = GetActorLocation();
loc = FVector(0.0f, 0.0f, 10.0f*DeltaTime*FMath::Cos(curTime*PI));
if (Player != nullptr) {
CollectionParticles->SetVectorParameter("PlayerPosition", 1.0f*(Player->GetActorLocation()-GetActorLocation()));
CollectionParticles->SetVectorParameter("PlayerSize1", Player->GetActorLocation() + (DeltaTime / 0.016f)*FVector(-45.0f, -45.0f, -45.0f));
CollectionParticles->SetVectorParameter("PlayerSize2", Player->GetActorLocation() + (DeltaTime / 0.016f)*FVector(45.0f, 45.0f, 45.0f));
CollectionParticles->SetFloatParameter("Strength", (1.0f/DeltaTime)*FMath::Clamp(GetWorldTimerManager().GetTimerElapsed(PostCollectionTimer) / 2.0f, 0.0f, 1.0f)*FMath::Clamp(GetWorldTimerManager().GetTimerElapsed(PostCollectionTimer) / 2.0f, 0.0f, 1.0f));
} else {
SetActorLocation(GetActorLocation() + loc);
GemModel->AddWorldRotation(FRotator(0.0f, 60.0f*DeltaTime, 0.0f));
}
// Eliot made me put this here.
if (GetWorldTimerManager().GetTimerElapsed(PostCollectionTimer) != -1.0f) {
gemmat->SetScalarParameterValue("Break", 20.0f*GetWorldTimerManager().GetTimerElapsed(PostCollectionTimer));
}
curTime += DeltaTime;
}
示例7: GetCapsuleComponent
ARTJamCharacter::ARTJamCharacter()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &ARTJamCharacter::OnHit);
// Don't rotate when the controller rotates.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Face in the direction we are moving..
GetCharacterMovement()->RotationRate = FRotator(0.0f, 720.0f, 0.0f); // ...at this rotation rate
GetCharacterMovement()->GravityScale = 2.f;
GetCharacterMovement()->AirControl = 0.80f;
GetCharacterMovement()->JumpZVelocity = 1000.f;
GetCharacterMovement()->GroundFriction = 3.f;
GetCharacterMovement()->MaxWalkSpeed = 600.f;
GetCharacterMovement()->MaxFlySpeed = 600.f;
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
bIsDead = false;
NormalImpulse = 800.f;
MaxImpulse = 1000.f;
ForceLength.Z = NormalImpulse;
}
示例8: SphereMesh
AShipPawn::AShipPawn()
{
PrimaryActorTick.bCanEverTick = true;
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMesh(TEXT("/Game/Assets/Ships/DroneShip"));
MeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComponent"));
MeshComponent->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
MeshComponent->SetStaticMesh(SphereMesh.Object);
MeshComponent->SetMobility(EComponentMobility::Movable);
MeshComponent->SetSimulatePhysics(true);
MeshComponent->BodyInstance.bLockZTranslation = true;
MeshComponent->SetEnableGravity(false);
MeshComponent->SetLinearDamping(ShipLinearDamping);
MeshComponent->SetAngularDamping(ShipAngularDamping);
MeshComponent->BodyInstance.bLockXRotation = true;
MeshComponent->BodyInstance.bLockYRotation = true;
RootComponent = MeshComponent;
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->AttachTo(RootComponent);
CameraBoom->bAbsoluteRotation = true;
CameraBoom->TargetArmLength = 20000.f;
CameraBoom->RelativeRotation = FRotator(-80.f, 0.f, 0.f);
CameraBoom->bDoCollisionTest = false;
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
CameraComponent->AttachTo(CameraBoom, USpringArmComponent::SocketName);
CameraComponent->bUsePawnControlRotation = false;
}
示例9: Super
ACapTheBrainCharacter::ACapTheBrainCharacter(const class FObjectInitializer& PCIP)
: Super(PCIP)
{
buff = 100;
buffTimer = 0;
buffDelay = 2;
score = 0;
firstUpdate = true;
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// set our turn rates for input
BaseTurnRate = 45.f;
BaseLookUpRate = 45.f;
// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
GetCharacterMovement()->JumpZVelocity = 200.f;
GetCharacterMovement()->AirControl = 0.2f;
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
示例10: check
//========================================================================
void AHexEditorActor::UpdateBarrierPlacing()
{
if (m_CurrentBarrier)
{
check(m_InputType == InputMode::Barriers);
Raycast<AHexTileActor>(this,
[&](auto& resultActor, auto& traceResult)
{
auto& coords = resultActor->GetCoordinates();
auto tilePos = m_Grid.GetPosition(coords);
auto toHit = traceResult.ImpactPoint - tilePos;
auto nId = GetNeighborId(toHit);
auto neighborRelativeCoordinates = T_HexGrid::HorizontalNeighborIndexes[nId];
auto pos = m_Grid.GetPositionBetweenTiles(coords, coords + neighborRelativeCoordinates);
m_CurrentBarrier->SetActorLocation(pos);
m_CurrentBarrier->SetActorRotation(FRotator(0, 60 * -(int)nId, 0));
m_CurrentBarrier->SetOwningTileBeforePlace(resultActor, nId);
},
[&]()
{
m_CurrentBarrier->SetOwningTileBeforePlace(nullptr);
});
}
}
示例11:
// Sets default values
ADog::ADog()
{
// 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;
AutoPossessPlayer = EAutoReceiveInput::Player0;
CollisionSphere =
CreateDefaultSubobject<USphereComponent>(TEXT("CollisionSphere"));
CollisionSphere->SetCollisionObjectType(ECollisionChannel::ECC_Pawn);
//Might want to tweak this in the editor depending on the size of the static mesh
CollisionSphere->InitSphereRadius(10.0f);
CollisionSphere->SetCollisionProfileName(TEXT("Pawn"));
RootComponent = CollisionSphere;
MovementComponent = CreateDefaultSubobject<UFloatingPawnMovement>("MovementComponent");
MovementComponent->SetUpdatedComponent(RootComponent);
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
StaticMesh->AttachTo(RootComponent);
OtherMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OtherMesh"));
OtherMesh->AttachTo(RootComponent);
OtherMesh->SetVisibility(false);
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->AttachTo(RootComponent);
Camera->SetRelativeLocation(FVector(-100.0f, 0.0f, 200.0f));
Camera->SetRelativeRotation(FRotator(-60.0f, 0.0f, 0.0f));
}
示例12: GetActorLocation
// Sets default values
AMyPawn::AMyPawn()
{
// 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;
//Set this pawn to be controlled by the lowest numbered player
AutoPossessPlayer = EAutoReceiveInput::Player0;
//Create a dummy root component to attach things to.
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
//create a camera and a visible object
UCameraComponent* OurCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("OurCamera"));
OurVisibleComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OurVisibleComponent"));
//attach our camera and visible object to the root
OurCamera->AttachTo(RootComponent);
(*OurVisibleComponent).AttachTo(RootComponent);
//offset camera
OurCamera->SetRelativeLocation(FVector(-250, 0, 250));
//rotate camera
OurCamera->SetRelativeRotation(FRotator(-45, 0, 0));
InitLocation = GetActorLocation();
}
示例13: EditingStore
FCreatureAnimStoreEditorViewportClient::FCreatureAnimStoreEditorViewportClient(const TWeakPtr<class SEditorViewport>& InEditorViewportWidget /*= nullptr*/, UCreatureAnimationClipsStore* EditingAnimStore)
:FEditorViewportClient(nullptr, &OwnerScene, InEditorViewportWidget)
, EditingStore(EditingAnimStore)
{
PreviewScene = &OwnerScene;
((FAssetEditorModeManager*)ModeTools)->SetPreviewScene(PreviewScene);
DrawHelper.bDrawGrid = true;
DrawHelper.bDrawPivot = true;
/*SetViewLocation(FVector(0, 30, 0));
SetLookAtLocation(FVector(0, -30, 0));*/
SetRealtime(true);
//向PreviewScene添加Component
EditingCreatureMesh = NewObject<UCreatureMeshComponent>();
//设置CreatureMesh组件
SetUpEditingCreatureMesh();
PreviewScene->AddComponent(EditingCreatureMesh, FTransform::Identity);
EditingCreatureMesh->SetRelativeRotation(FRotator(0, 90, 0));
//设置Camera
SetUpCamera();
if (EditingStore->ClipList.Num()!=0)
{
//默认播放第一个Clip
EditingCreatureMesh->SetBluePrintActiveCollectionClip_Name(EditingStore->ClipList[0].ClipName);
}
}
示例14: FConstructorStatics
// Sets default values
ASceneBarricades::ASceneBarricades()
{
// 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;
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinderOptional<UStaticMesh> barricadeShape;
ConstructorHelpers::FObjectFinderOptional<UMaterialInstance> barricadeMaterial;
FConstructorStatics()
: barricadeShape(TEXT("/Game/MapProps/blockade.blockade"))
, barricadeMaterial(TEXT("Material'/Game/MapProps/cementLight.cementLight'"))
{
}
};
static FConstructorStatics ConstructorStatics;
// Create dummy root scene component
//DummyRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Dummy0"));
//RootComponent = DummyRoot;
ItemBasicMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("item_shape"));
// Create random mesh component
ItemBasicMesh->SetStaticMesh(ConstructorStatics.barricadeShape.Get());
ItemBasicMesh->SetMaterial(0, ConstructorStatics.barricadeMaterial.Get());
ItemBasicMesh->SetRelativeScale3D(FVector(0.2f,0.2f,0.2f));
ItemBasicMesh->SetRelativeLocation(FVector(0.f,0.f,0.f));
ItemBasicMesh->SetRelativeRotation(FRotator(0.f, 0.f, 0.f));
//ItemBasicMesh->AttachTo(DummyRoot);
health = 3;
this->OnActorHit.AddDynamic(this, &ASceneBarricades::onHit);
}
示例15: CombineRotators
FRotator CombineRotators(FRotator A, FRotator B)
{
FQuat AQuat = FQuat(A);
FQuat BQuat = FQuat(B);
return FRotator(BQuat*AQuat);
}