当前位置: 首页>>代码示例>>C++>>正文


C++ GetActorLocation函数代码示例

本文整理汇总了C++中GetActorLocation函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActorLocation函数的具体用法?C++ GetActorLocation怎么用?C++ GetActorLocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetActorLocation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetWorld

void ASpawnerTrigger::spawn(){
	if(whatToSpawn!=NULL){
		UWorld* world = GetWorld();
		if (world) {
			FActorSpawnParameters params;
			params.Owner = this;
			params.bNoCollisionFail = true;
			FVector loc = GetActorLocation()+offset;
			FRotator rotation = FRotator::ZeroRotator;
			rotation.Yaw = 90.f;
			AActor *a = world->SpawnActor<AActor>(whatToSpawn, loc, rotation, params);
			++nbSpawned;
			if( nbSpawned < numToSpawn){ 
				FTimerHandle timerHandler;
				GetWorldTimerManager().SetTimer(timerHandler, this, &ASpawnerTrigger::spawn, timeBetweenSpawn, false);
			}
		}
		if(bDestroyWhenFinished && nbSpawned >= numToSpawn){ Destroy(); }
	}
}
开发者ID:yongaro,项目名称:Borderlands,代码行数:20,代码来源:SpawnerTrigger.cpp

示例2: GetWorld

void AWeapon::FireFunction(){
	
	if (firedObject){
		UWorld* world = GetWorld();
		if (world){
			FActorSpawnParameters parameters = FActorSpawnParameters(); 
			parameters.bNoCollisionFail = true;
			parameters.Instigator = Owner;
			parameters.Name = GetProjectileName();
			FVector spawnLocation = GetActorLocation();
			FRotator spawnRotation = GetActorRotation();
			AActor* Spawned = world->SpawnActor(*firedObject, &spawnLocation, &spawnRotation,parameters);
			AFirable* firable = Cast<AFirable>(Spawned);
			firable->SetColor(ProjectileColor);
			firable->Instigator = Owner->GetController();
			firable->Damage = damage;
			firable->OwnerID = OwnerShipNumber;
		}
	}
}
开发者ID:AlexZhangji,项目名称:ShootingStar,代码行数:20,代码来源:Weapon.cpp

示例3: GetActorLocation

TArray<RobotDataTypes::PlayerLocation>* ARobot::getVisiblePlayers()
{
	FVector ownLocation = GetActorLocation();
	FRotator ownRotation = GetActorRotation();
	TArray<RobotDataTypes::PlayerLocation>* visiblePlayerLocations = new TArray<RobotDataTypes::PlayerLocation>();

	//Iterate through all Robots	
	for (TActorIterator<ARobot> ActorItr(GetWorld()); ActorItr; ++ActorItr)
	{
		ARobot* robot = Cast<ARobot>(*ActorItr);
		if (this == robot) continue;
		
		if (isObjectVisible(robot->getPosition()))
		{
			visiblePlayerLocations->Add(RobotDataTypes::PlayerLocation{ robot->getTeamId(), robot->getPlayerId(), new FVector(robot->getPosition()) });
		}
	}

	return visiblePlayerLocations;
}
开发者ID:RocketRider,项目名称:UnrealCup,代码行数:20,代码来源:Robot.cpp

示例4: GetActorLocation

void APlayerOvi::AjustPosition() {
  FVector location = GetActorLocation();

  if (location.X > m_limit)
    location.X = m_limit;
  else if (location.X < -m_limit)
    location.X = -m_limit;

  if (location.Y > m_limit)
    location.Y = m_limit;
  else if (location.Y < -m_limit)
    location.Y = -m_limit;

  if (location.Z > m_limit)
    location.Z = m_limit;
  else if (location.Z < -m_limit)
    location.Z = -m_limit;

  SetActorLocation(location);
}
开发者ID:alfreSosa,项目名称:TowardTheLight,代码行数:20,代码来源:PlayerOvi.cpp

示例5: AttachDriver_Implementation

void AUTWeaponPawn::AttachDriver_Implementation(APawn* P)
{
	AUTCharacter* Char = Cast<AUTCharacter>(P);
	if (Char != NULL)
	{
		// UTP.SetWeaponAttachmentVisibility(false); // TODO: FIXME: Weapon attachement visibility // TODO: PR for SetWeaponAttachmentVisibility

		if (MyVehicle->bAttachDriver)
		{
			// UC: UTP.SetCollision(false, false);
			// UC: UTP.bCollideWorld = false;
			Char->SetActorEnableCollision(false);

			//UTP.SetHardAttach(true);  // TODO: FIXME: add hard attach
			Char->SetActorLocation(GetActorLocation());
			//UTP.SetPhysics(PHYS_None); // TODO: FIXME: Set Physics state

			MyVehicle->SitDriver(Char, MySeatIndex);
		}
	}
}
开发者ID:UTCommunity,项目名称:UTVehicles,代码行数:21,代码来源:UTWeaponPawn.cpp

示例6: GetActorLocation

/** Update the modifier */
void AFluidSurfaceOscillator::Update( float DeltaTime )
{
	if( !FluidActor )
		return;

	OscTime += DeltaTime;

	// If frequency is zero - just set velocity to strength
	float Period, Amp, CurrPhase;

	if( Frequency > 0.0001f )
	{
		Period = 1.f / Frequency;
		CurrPhase = ( FMath::Fmod( OscTime, Period ) * Frequency ) + (float) Phase / 255.f;
		Amp = Strength * FMath::Sin( CurrPhase * PI * 2 );
	}
	else
		Amp = Strength;

	FluidActor->FluidSurfaceComponent->Pling( GetActorLocation( ), Amp, Radius );
}
开发者ID:Kthulhu,项目名称:FluidSurface,代码行数:22,代码来源:FluidSurfaceOscillator.cpp

示例7: GetWorld

void ATankAIController::Tick(float DeltaTime){
    
    Super::Tick(DeltaTime);
    
    auto PlayerTank = GetWorld()->GetFirstPlayerController()->GetPawn();
    
    auto ControlledTank = GetPawn();
    
    if(!ensure(PlayerTank && ControlledTank)){return ; }
        
        //move towards player
        MoveToActor(PlayerTank, AcceptanceRadius);
        //aim towards the player
    auto AimingComponent = ControlledTank->FindComponentByClass<UTankAimingComponent>();
        AimingComponent->AimAt(PlayerTank->GetActorLocation());
        //Fire if ready
    if(AimingComponent->GetFiringStatus() == EFiringStatus::Locked)
    {
    AimingComponent->Fire();
    }
}
开发者ID:brolol07,项目名称:04_BattleTanks,代码行数:21,代码来源:TankAIController.cpp

示例8: SetRootComponent

void AProjectile::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit)
{
	LaunchBlast->Deactivate();
	ImpactBlast->Activate();
	ExplosionForce->FireImpulse();

	SetRootComponent(ImpactBlast);
	CollisionMesh->DestroyComponent();

	UGameplayStatics::ApplyRadialDamage(
		this,
		ProjectileDamage,
		GetActorLocation(),
		ExplosionForce->Radius,
		UDamageType::StaticClass(),
		TArray<AActor*>() // don't ignore any actors
	);

	auto Timer = FTimerHandle();
	GetWorld()->GetTimerManager().SetTimer(Timer, this, &AProjectile::OnTimerExpire, DestroyDelay, false);
}
开发者ID:mrharris,项目名称:BattleTank,代码行数:21,代码来源:Projectile.cpp

示例9: Reload

void AHunterMarxo::Attack()
{
		if (MainProjectile != NULL)
		{
				if (Ammo < 1)
				{
						Reload();
						return;
				}
				MainProjectile ->GetDefaultObject<ABasicProjectile>()->SetDamage(Super::Attack);
				const FRotator SpawnRotation = CameraArm->GetComponentRotation();
				const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(MainOffset);

				UWorld* const World = GetWorld();
				if (World != NULL)
				{
						World->SpawnActor<ABasicProjectile>(MainProjectile, SpawnLocation, SpawnRotation);
				}
				Ammo--;
		}
}
开发者ID:kcnklub,项目名称:In-The-Palms3d,代码行数:21,代码来源:HunterMarxo.cpp

示例10: if

void AProjectileSpell::UpdateProjectileVelocity()
{
	auto character = Cast<ABaseCharacter>(this->GetInstigator());
	if (character && character->Controller) {
		FVector rotator;
		FVector characterRotation = character->Controller->GetControlRotation().Vector();

		if (TargetDirection != FVector(0)) {
			rotator = TargetDirection;
		} 
		else if (TargetLocation != FVector(0)) {
			auto position = character->GetActorLocation();
			rotator = UKismetMathLibrary::FindLookAtRotation(position, TargetLocation).Vector();
		}
		else {
			rotator = characterRotation;
		}

		MovementComponent->Velocity = rotator * MovementComponent->InitialSpeed;
	}
}
开发者ID:metsfan,项目名称:thirdpersonproject,代码行数:21,代码来源:ProjectileSpell.cpp

示例11: GetWorld

void ATankAIController::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	auto PlayerTank = GetWorld()->GetFirstPlayerController()->GetPawn();
	auto ControlledTank =GetPawn();
	if (!ensure(PlayerTank && ControlledTank)) { return; }
	//Move Towards the player
	MoveToActor(PlayerTank, AcceptanceRadius);

	//aim towards the player
	auto AimingComponent = ControlledTank->FindComponentByClass<UTankAimingComponent>();
	AimingComponent->AimAt(PlayerTank->GetActorLocation());
		
	//if aiming or locked
	if (AimingComponent->GetFiringState() == EFiringState::Locked)
	{
		AimingComponent->Fire(); //TODO dont fire every frame , limit fire rate
	}
	
}
开发者ID:pappszi,项目名称:04_BattleTank,代码行数:21,代码来源:TankAIController.cpp

示例12: UE_LOG

void AMeteorProjectile::OnHit(AActor* SelfActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit)
{
	UE_LOG(LogTemp, Display, TEXT("METEOR HIT"));

	TArray<FOverlapResult> res;

	if (GetWorld()->OverlapMultiByChannel(res, GetActorLocation(), FQuat::Identity, ECollisionChannel::ECC_Visibility, FCollisionShape::MakeSphere(300)))
	{
		for (auto a : res)
		{
			if (a.Actor.IsValid() && Cast<ABaseGamer>(a.Actor.Get()))
			{
				a.Actor->TakeDamage(FMath::FRandRange(6000, 16000), FDamageEvent(), GetInstigator() ? GetInstigator()->GetController() : nullptr, this);
			}
		}
	}

	//DrawDebugSphere(GetWorld(), GetActorLocation(), 300, 16, FColor::Red, false, 1);

	Destroy();
}
开发者ID:Quadtree,项目名称:LD33,代码行数:21,代码来源:MeteorProjectile.cpp

示例13: GetRootComponent

void AActor::EditorApplyScale( const FVector& DeltaScale, const FVector* PivotLocation, bool bAltDown, bool bShiftDown, bool bCtrlDown )
{
	if( RootComponent != NULL )
	{
		const FVector CurrentScale = GetRootComponent()->RelativeScale3D;

		// @todo: Remove this hack once we have decided on the scaling method to use.
		FVector ScaleToApply;

		if( AActor::bUsePercentageBasedScaling )
		{
			ScaleToApply = CurrentScale * (FVector(1.0f) + DeltaScale);
		}
		else
		{
			ScaleToApply = CurrentScale + DeltaScale;
		}

		GetRootComponent()->SetRelativeScale3D(ScaleToApply);

		if (PivotLocation)
		{
			const FVector CurrentScaleSafe(CurrentScale.X ? CurrentScale.X : 1.0f,
										   CurrentScale.Y ? CurrentScale.Y : 1.0f,
										   CurrentScale.Z ? CurrentScale.Z : 1.0f);

			FVector Loc = GetActorLocation();
			Loc -= *PivotLocation;
			Loc *= (ScaleToApply / CurrentScaleSafe);
			Loc += *PivotLocation;
			GetRootComponent()->SetWorldLocation(Loc);
		}
	}
	else
	{
		UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyTranslation %s has no root component"), *GetName() );
	}

	FEditorSupportDelegates::UpdateUI.Broadcast();
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:40,代码来源:ActorEditor.cpp

示例14: GetActorLocation

void AInteractDoors::Interact(AActor* Interactor)
{
		if (!bIsLocked)
		{
				if (bIsOpen)
				{
					bIsOpen = false;
				}
				else
				{
					bIsOpen = true;
				}
				UGameplayStatics::PlaySoundAtLocation(GetWorld(), SoundEffect, GetActorLocation());

				UInteractableAnimInstance* DoorAnim = Cast<UInteractableAnimInstance>(SkeletalMesh->GetAnimInstance());
				
				if (DoorAnim)
				{
					DoorAnim->bActivated = true;
				}
		}
}
开发者ID:Snowman5717,项目名称:SymphonyOfShadows,代码行数:22,代码来源:InteractDoors.cpp

示例15: ServerDropWeapon

void ASCharacter::DropWeapon()
{
	if (Role < ROLE_Authority)
	{
		ServerDropWeapon();
		return;
	}

	if (CurrentWeapon)
	{
		FVector CamLoc;
		FRotator CamRot;

		if (Controller == nullptr)
			return;

		/* Find a location to drop the item, slightly in front of the player. */
		Controller->GetPlayerViewPoint(CamLoc, CamRot);
		const FVector Direction = CamRot.Vector();
		const FVector SpawnLocation = GetActorLocation() + (Direction * DropItemDistance);

		FActorSpawnParameters SpawnInfo;
		SpawnInfo.bNoCollisionFail = true;
		ASWeaponPickup* NewWeaponPickup = GetWorld()->SpawnActor<ASWeaponPickup>(CurrentWeapon->WeaponPickupClass, SpawnLocation, FRotator::ZeroRotator, SpawnInfo);

		if (NewWeaponPickup)
		{
			/* Apply torque to make it spin when dropped. */
			UStaticMeshComponent* MeshComp = NewWeaponPickup->GetMeshComponent();
			if (MeshComp)
			{
				MeshComp->SetSimulatePhysics(true);
				MeshComp->AddTorque(FVector(1, 1, 1) * 4000000);
			}
		}

		RemoveWeapon(CurrentWeapon);
	}
}
开发者ID:MarcioGeremia,项目名称:EpicSurvivalGameSeries,代码行数:39,代码来源:SCharacter.cpp


注:本文中的GetActorLocation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。