• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetActorLocation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetActorLocation

void SELF::RegisterArtifact()
{
	int i;
	AUTCTFFlag* Artifact;
	FActorSpawnParameters Params;
	Params.Owner = this;

	ArtifactNum++;
	Artifact = (*GetWorld()).SpawnActor<AUTCTFFlag>(TeamFlagTypes[TeamNum], GetActorLocation() + FVector(0,0,96), GetActorRotation(), Params);
	if (Artifact)
	{
		ArtifactIDs.Add(Artifact);
		(*Artifact).Init(this);
		// GEm: If not for legacy reasons, could just call Destroy() on the old artifact, but now deactivate the last one
		for (i = 0; i < ArtifactIDs.Num(); i++)
		{
			if (!Cast<AXMPArtifact>(ArtifactIDs[i])->bEnabled)
				Cast<AXMPArtifact>(ArtifactIDs[i])->Deactivate();
		}
		UpdateLegacy();
	}
}
开发者ID:saiboat,项目名称:UT4XMPGameMode,代码行数:22,代码来源:XMPArtifactNode.cpp


示例17: GetActorForwardVector

void APlayerOvi::BeginPlay() {
  Super::BeginPlay();
  //tag player
  this->Tags.Add("Player");

  // time for button animation
  m_elapsedAltar = m_elapsedPortal = m_elapsedButton = 0.0f;
  // material for capsule
  CapsuleComponent->SetMaterial(0, nullptr);
  // calculate limit world & initial orientation
  float dotForward = FVector::DotProduct(FVector(1, 1, 1), GetActorForwardVector());
  if (dotForward < 0)
    m_state = States::LEFT;
  else
    m_state = States::RIGHT;

  m_limit = FVector::DotProduct(GetActorLocation(), GetActorRightVector());
  m_limit = abs(m_limit);

  //GetCaspuleValues for simulate physics
  m_capsuleHeight = CapsuleComponent->GetScaledCapsuleHalfHeight();
  m_capsuleRadious = CapsuleComponent->GetScaledCapsuleRadius();
  m_capsuleHeightPadding = m_capsuleHeight * PADDING_COLLISION_PERCENT;
  m_capsuleRadiousPadding = m_capsuleRadious * PADDING_COLLISION_PERCENT_RADIOUS;
  m_capsuleHeightPaddingFeet = m_capsuleHeight * PADDING_COLLISION_PERCENT_FEET;

  //Set player Stick in the animation socket
  if (Mesh) {
    m_stick = GetWorld()->SpawnActor<AStick>(AStick::StaticClass());
    const USkeletalMeshSocket *socket = Mesh->GetSocketByName("Puntodeacople_Baston");
    if (socket)
      socket->AttachActor(m_stick, Mesh);
    m_colorKey = FLinearColor(FVector(0.5f));
    m_stick->SetColor(FLinearColor(FVector(0.5f)), 5.0f);
  }

  m_inTutorial = false;
  m_isValid = false;
}
开发者ID:alfreSosa,项目名称:TowardTheLight,代码行数:39,代码来源:PlayerOvi.cpp


示例18: GetActorLocation

void ALeafNode::DebugDraw()
{
	const FVector location = GetActorLocation();

	if (UWorld* const a_World = Tree->tidGetWorld())
	{

		FColor Color = FColor::Red;

		//Left
		FVector Start = FVector(location.X, location.Y, location.Z);
		FVector End = FVector(location.X, location.Y + Dimensions.Y, location.Z);

		DrawDebugLine(a_World, Start, End, Color);

		//Bottom
		Start = FVector(location.X, location.Y, location.Z);
		End = FVector(location.X + Dimensions.X, location.Y, location.Z);

		DrawDebugLine(a_World, Start, End, Color);

		//Right
		Start = FVector(location.X + Dimensions.X, location.Y, location.Z);
		End = FVector(location.X + Dimensions.X, location.Y + Dimensions.Y, location.Z);

		DrawDebugLine(a_World, Start, End, Color);

		//Top
		Start = FVector(location.X + Dimensions.X, location.Y + Dimensions.Y, location.Z);
		End = FVector(location.X, location.Y + Dimensions.Y, location.Z);

		DrawDebugLine(a_World, Start, End, Color);

		// Draw debug box at center of node
		//const FVector2D roomPosition = FVector2D(location.X + Dimensions.X * 0.5f, location.Y + Dimensions.Y * 0.5f);
		//DrawDebugBox(a_World, FVector(roomPosition.X, roomPosition.Y, 5.0f), FVector(10.0f), FColor::Blue);

	}
}
开发者ID:timburrows,项目名称:tid,代码行数:39,代码来源:LeafNode.cpp


示例19: GetActorUpVector

bool ADraggableMoveTile::cameraRayIntersectWithTilePlane(
									 const FVector& camlocation,
									 const FVector& dir,
									 FVector& hitPoint)

{
	bool hitPlane = false;
	auto planeNormal = GetActorUpVector();
	auto demon = FMath::Abs(FVector::DotProduct(dir, planeNormal));

	if (demon > FLT_EPSILON)
	{
		auto t = FVector::DotProduct(camlocation - GetActorLocation(), planeNormal) / demon;
		hitPlane = t >= 0;
		if (hitPlane)
		{
			hitPoint = camlocation + dir * t;
		}
	}

	return hitPlane;
}
开发者ID:pokelege,项目名称:ProjectTap_Code,代码行数:22,代码来源:DraggableMoveTile.cpp


示例20: GetActorLocation

// Called when the game starts or when spawned
void AGib::BeginPlay()
{
	Super::BeginPlay();
	FVector Origin = this->GetActorLocation();
	//SetActorLocation(FVector(Origin.X, Origin.Y, FloorOffset));
	IsAttacked = false;

	//Applying Impulse force and setting physics on
	GibMesh1->SetSimulatePhysics(true);
	GibMesh1->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);

	GibMesh2->SetSimulatePhysics(true);
	GibMesh2->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);

	GibMesh3->SetSimulatePhysics(true);
	GibMesh3->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);
	
	GibMesh4->SetSimulatePhysics(true);
	GibMesh4->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);
	
	GibMesh5->SetSimulatePhysics(true);
	GibMesh5->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);
	
	GibMesh6->SetSimulatePhysics(true);
	GibMesh6->AddRadialImpulse(Origin, ForceRadius, ImpulseForce, ERadialImpulseFalloff::RIF_Linear, true);
	

	//Play sound effect
	if (GibSound != NULL)
	{
		UGameplayStatics::PlaySoundAtLocation(this, GibSound, GetActorLocation(), 1, 1);
	}

	//Spawn Particle
	//if (Particles != NULL)
	//{
	//}
}
开发者ID:TheRealKevinStone,项目名称:Max,代码行数:39,代码来源:Gib.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetActorRotation函数代码示例发布时间:2022-05-30
下一篇:
C++ GetActorForwardVector函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap