这篇教程C++ GetActorRotation函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetActorRotation函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActorRotation函数的具体用法?C++ GetActorRotation怎么用?C++ GetActorRotation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetActorRotation函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetNearbySocketvoid ACoverActor::DetermineMovementDirection(FVector& MovementDirection, FRotator& FacingDirection){ FName NearbySocket = GetNearbySocket(); AActor* Char = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0); //Determine the movement and facing direction of the player, based on the described logic //The way that we're deciding the facing direction is similar to the way we've decided //the movement direction if (NearbySocket.IsEqual("ForwardSocket")) { MovementDirection = -GetActorRightVector(); FacingDirection = GetActorRotation(); } else if (NearbySocket.IsEqual("BackwardSocket")) { MovementDirection = GetActorRightVector(); FacingDirection = GetActorRotation() + FRotator(0, 180, 0); } else if (NearbySocket.IsEqual("RightSocket")) { MovementDirection = GetActorForwardVector(); FacingDirection = GetActorRotation() + FRotator(0, 90, 0); } else { MovementDirection = -GetActorForwardVector(); FacingDirection = GetActorRotation() + FRotator(0, -90.f, 0); }}
开发者ID:orfeasel,项目名称:UE4-Game-Systems,代码行数:30,
示例2: FObjectActionvoid ABrainNormalInteractiveObject::BeginPlay(){ Super::BeginPlay(); int8 flags = (_canBeRotate ? EAction::ROTATE : 0) | (_canBeTranslate ? EAction::TRANSLATE : 0) | (_canBeScale ? EAction::SCALE : 0) | (_canBeShear ? EAction::SHEAR : 0); _actions = FObjectAction(flags); // Init Rotate _currentRotation = GetActorRotation(); _targetRotation = GetActorRotation(); // Init Translate _currentTranslation = GetActorLocation(); _targetTranslation = GetActorLocation(); // Init Scale _targetScale = _initScale; _currentScale = _initScale; // Init Shear _currentShearFirstAxis = 0; _currentShearSecondAxis = 0; _targetShearFirstAxis = 0; _targetShearSecondAxis = 0; _cachedTransform = GetTransform(); if (this->GetClass()->ImplementsInterface(UBrainSaveInterface::StaticClass())) Load();}
开发者ID:gamer08,项目名称:prog,代码行数:33,
示例3: UE_LOGvoid AZombieShooterCharacter::ServerPerformAttack_Implementation(){ //Perform the actual attack here UE_LOG(LogTemp, Warning, TEXT("Server Performing attack!")); //In final product, will call the currently equipped weapon's fire function //For now, just fire a basic projectile if (ProjectileClass != NULL) { //MuzzleRotation.Pitch += 10.0f; UWorld* const World = GetWorld(); if (World) { FActorSpawnParameters SpawnParams; SpawnParams.Owner = this; SpawnParams.Instigator = Instigator; //Spawn projectile at muzzle FVector FireLocation = GetActorLocation() + FTransform(GetActorRotation()).TransformVector(FVector(25.0f, 0.0f, 0.0f)); Projectile = World->SpawnActor<AProjectile>(ProjectileClass, FireLocation, GetActorRotation(), SpawnParams); if (Projectile) { //Find launch direction FVector const LaunchDir = GetActorRotation().Vector(); //FVector const LaunchDir = CameraBoom->GetComponentRotation().Vector(); Projectile->SetReplicates(true); Projectile->InitVelocity(LaunchDir); } } }}
开发者ID:DisposedCheese,项目名称:ZombieShooter,代码行数:30,
示例4: GetWorldvoid AFireDart::OnHit_Implementation(AActor * OtherActor) { if (OtherActor != GetOwner()) { ABanditCharacter* Bandit = Cast<ABanditCharacter>(OtherActor); ABaseTicker* Ticker = Cast<ABaseTicker>(OtherActor); if (Bandit) { if (Explosion) { UWorld* const World = GetWorld(); const FVector SpawnLocation = GetActorLocation(); const FRotator SpawnRotation = GetActorRotation(); World->SpawnActor<AActor>(Explosion, SpawnLocation,SpawnRotation); UGameplayStatics::ApplyDamage(Bandit, Damage, this->GetInstigatorController(), this, UDamageType::StaticClass()); this->Destroy(); } } else if (Ticker) { if (Explosion) { UWorld* const World = GetWorld(); const FVector SpawnLocation = GetActorLocation(); const FRotator SpawnRotation = GetActorRotation(); World->SpawnActor<AActor>(Explosion, SpawnLocation, SpawnRotation); UGameplayStatics::ApplyDamage(Ticker, Damage, this->GetInstigatorController(), this, UDamageType::StaticClass()); this->Destroy(); } } } }
开发者ID:TheRealKevinStone,项目名称:Max,代码行数:35,
示例5: FNamevoid ADuckTower::Shoot(float distance){ /* const FName filename = FName(TEXT("Blueprint'/Game/Blueprints/PickUp.PickUp'")); FVector loc = GetAttachParentActor()->GetActorLocation(); FRotator rot = GetAttachParentActor()->GetActorRotation(); SpawnBP(GetWorld(), (UClass*)LoadObjFromPath<UBlueprint>(&filename), loc, rot); */ APawn *player = UGameplayStatics::GetPlayerController(GetWorld(), 1)->GetControlledPawn(); int randomValue = distance / 10000; FVector vec = player->GetActorLocation() + FVector(FMath::RandRange(-randomValue, randomValue), FMath::RandRange(-randomValue, randomValue), 0.0f); //+ player->GetRootPrimitiveComponent()->GetPhysicsLinearVelocity() *DeltaSeconds * 10; FVector vec2 = GetActorLocation(); FVector Direction = vec - vec2; FRotator test = FRotationMatrix::MakeFromX(Direction).Rotator(); FRotator test2 = FRotator(1.0f, 0.0f, 0.0f); FRotator finalrot = FRotator(test.Quaternion() * test2.Quaternion()); FVector forward = GetActorForwardVector(); finalrot.Roll = -finalrot.Roll; finalrot.Yaw = -finalrot.Yaw; finalrot.Pitch = -finalrot.Pitch; FVector loc = GetActorLocation() + forward * 500.0f; FRotator rot = GetActorRotation(); AActor* actor = GetWorld()->SpawnActor<AActor>(BulletBlueprint, loc, GetActorRotation()); actor->SetActorScale3D(FVector(3.0f, 3.0f, 3.0f)); //actor->GetRootPrimitiveComponent()->AddImpulse(actor->GetActorForwardVector()* 5000.0f); //actor->GetRootPrimitiveComponent()->SetPhysicsLinearVelocity(actor->GetActorForwardVector()*10000.0f); //* (distance/10000 * 1.0f));}
开发者ID:SlooBo,项目名称:RalliaPerkele,代码行数:30,
示例6: SetActorRotationFRotator AGGJ16_Player::CalculateTargetRotation(){ float Yaw = FMath::RadiansToDegrees(FMath::Atan2(CurrentInputRotation.Y, CurrentInputRotation.X)); SetActorRotation(FMath::Lerp(GetActorRotation(), FRotator(0.f, Yaw, 0.f), RotationAlpha)); return GetActorRotation();}
开发者ID:AnagramMC,项目名称:fantastic_pancakes,代码行数:7,
示例7: GetActorRotation// Called when the game starts or when spawnedvoid AInteractDoors::BeginPlay(){ Super::BeginPlay(); bIsOpen = false; rotationClosed = GetActorRotation(); rotationOpen = GetActorRotation(); rotationOpen.Yaw += 90;}
开发者ID:Snowman5717,项目名称:SymphonyOfShadows,代码行数:10,
示例8: GetActorRotationvoid ACloud10Character::DiveRight(float Value, float deltaSeconds){ float prevYaw = GetActorRotation().Yaw; float minDeltaYaw = minYaw - prevYaw; float maxDeltaYaw = maxYaw - prevYaw; //roll character in an angle front and back curYawAmt = Value; /* const FRotator Rotation = GetActorRotation(); FRotator dRotation(0, 0, 0); //curYawAmt * rotationRate const FVector Direction = FVector(0.0f, (curYawAmt * rotationRate), 0.0f) ;//= FRotationMatrix(Rotation).GetUnitAxis(EAxis::Z); dRotation = Direction.Rotation(); dRotation.Yaw = FMath::ClampAngle(dRotation.Yaw, minDeltaYaw, maxDeltaYaw); //dRotation.Yaw = curYawAmt + Direction.Z;//FMath::ClampAngle(curYawAmt * Direction.Z, minDeltaYaw, maxDeltaYaw); //Controller->SetControlRotation(dRotation); //AddControllerYawInput(dRotation.Yaw); FRotator tempRotation = FMath::RInterpTo(Rotation, dRotation, 3, 0); AddActorLocalRotation(tempRotation); //AddActorWorldRotation(dRotation); */ FRotator Rotation = GetActorRotation(); FVector moveDirection = FRotationMatrix(Rotation).GetUnitAxis(EAxis::Z); //velocity movement based upon forward vector in left/right direction const FVector ForwardDir = GetActorForwardVector(); FVector AddPos = ForwardDir; AddPos = moveDirection * AddPos; //add forward velocity and value of direction AddMovementInput(AddPos, Value); //adjust yaw /*float val = 30; float axisVal; UStaticMeshComponent* smc = Cast<UStaticMeshComponent>(RootComponent); axisVal = Value * val; //add tilting movement control on left & right FRotator Rotation = GetActorRotation(); Rotation.Roll = Value; AddActorLocalRotation(Rotation);*/ //curRollAmt = Value; // find out which way is right /*const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); //smc->SetPhysicsLinearVelocity(Direction * axisVal); AddControllerYawInput((Direction * axisVal));*/}
开发者ID:KaroA,项目名称:Cloud-10,代码行数:54,
示例9: GetWorldvoid AdeezProjectile::OnHit(UPrimitiveComponent* ThisComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit){ if ((OtherActor != NULL) && (OtherActor != this) && (OtherComp != NULL)) { // spawn FX AImpactFX* FX = GetWorld()->SpawnActorDeferred<AImpactFX>(ImpactTemplate, FTransform(Hit.Normal.Rotation(), Hit.Location), nullptr, Instigator, ESpawnActorCollisionHandlingMethod::AlwaysSpawn); if (FX) { FCollisionQueryParams Params = FCollisionQueryParams(FName(TEXT("RV_Trace")), true, this); Params.bTraceComplex = true; Params.bTraceAsyncScene = true; Params.bReturnPhysicalMaterial = true; FHitResult secondHit(ForceInit); FVector StartTrace; FVector EndTrace; StartTrace = GetActorLocation() - GetActorRotation().Vector() * 50; EndTrace = GetActorLocation() + GetActorRotation().Vector() * 200; GetWorld()->LineTraceSingleByChannel(secondHit, StartTrace, EndTrace, COLLISION_Weapon, Params); FPointDamageEvent PointDmg; //PointDmg.DamageTypeClass = DamageType; PointDmg.HitInfo = secondHit; PointDmg.ShotDirection = this->GetActorForwardVector(); PointDmg.Damage = Damage; if (this->GetOwner() && this->GetOwner()->GetInstigatorController()) { OtherActor->TakeDamage(Damage, PointDmg, this->GetOwner()->GetInstigatorController(), this->GetOwner()); } if (secondHit.bBlockingHit) { FX->SurfaceHit = secondHit; UGameplayStatics::FinishSpawningActor(FX, FTransform(FX->SurfaceHit.Normal.Rotation(), FX->SurfaceHit.Location)); } // simulate impact if (OtherComp->IsSimulatingPhysics()) { OtherComp->AddImpulseAtLocation(GetProjectileMovement()->Velocity * MassMultiplier, GetActorLocation()); } } } Destroy();}
开发者ID:s7evinkelevra,项目名称:deez,代码行数:53,
示例10: SetActorRotation// Called every framevoid AInteractDoors::Tick( float DeltaTime ){ Super::Tick( DeltaTime ); if (bIsOpen) { SetActorRotation(FMath::RInterpTo(GetActorRotation(), rotationOpen, DeltaTime, 5.f)); } else { SetActorRotation(FMath::RInterpTo(GetActorRotation(), rotationClosed, DeltaTime, 5.f)); }}
开发者ID:Snowman5717,项目名称:SymphonyOfShadows,代码行数:14,
|