您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetActorForwardVector函数代码示例

51自学网 2021-06-01 21:03:33
  C++
这篇教程C++ GetActorForwardVector函数代码示例写得很实用,希望能帮到您。

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

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

示例1: GetWorld

void AMagnetTile::PullBall( ABallPawn* ball ){	auto prim = Cast<UPrimitiveComponent>( ball->GetRootComponent() );	UWorld* world = GetWorld();	auto DeltaTime = world->DeltaTimeSeconds;	AProjectTapGameState* gameState;	if ( world != nullptr && ( gameState = world->GetGameState<AProjectTapGameState>() ) != nullptr && gameState->SetMagnetTile( this ) != this )	{		FVector angular = FVector::ZeroVector;		prim->SetPhysicsAngularVelocity( angular );		float distanceAtNormal = FVector::DotProduct( ball->GetActorLocation() - GetActorLocation() , GetActorForwardVector() );		FVector normalLoc = ( distanceAtNormal * GetActorForwardVector() ) + GetActorLocation();		FVector normalToBall = ball->GetActorLocation() - normalLoc;		float dist = normalToBall.Size();		if ( dist > centerTolerance )		{			FVector toAdd = dist * -normalToBall.GetSafeNormal();			toAdd.Z = 0;			prim->AddRelativeLocation( toAdd );		}	}	if ( isVertical )	{		attractionSpeed *= verticalForceMultiplier;	}	float originalSpeed = prim->GetPhysicsLinearVelocity().Size();	float newSpeed = attractionSpeed + originalSpeed;	prim->SetPhysicsLinearVelocity(newSpeed * -GetActorForwardVector());}
开发者ID:pokelege,项目名称:ProjectTap_Code,代码行数:29,


示例2: GetWorld

void ACVehicleSpawner::OnTimer() {	FTimerHandle Handle;	if (!Active || Paused) {		GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, GetTimeWait(), false);		return;	}	if (Bucket.Num() == 0) {		GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("You need to add Vehicle Types to the Vehicle Spawner"));	}	FVector StartTrace = GetActorLocation() - GetActorForwardVector() * 400 + FVector(0, 0, 100);	FVector EndTrace = GetActorLocation() + GetActorForwardVector() * 400 + FVector(0, 0, 100);	if (GetWorld()->LineTraceTest(			StartTrace,			EndTrace,			ECollisionChannel::ECC_Vehicle,			FCollisionQueryParams(),			FCollisionResponseParams()			)) {		GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, 0.1f, false);		return;	}	FActorSpawnParameters spawnParameters;	spawnParameters.bNoCollisionFail = true;	spawnParameters.Owner = this;	spawnParameters.Instigator = NULL;	spawnParameters.bDeferConstruction = false;	int32 BucketIndex = FMath::RandRange(0, Bucket.Num() - 1);	EVehicleType VehicleType = Bucket[BucketIndex];	Bucket.RemoveAtSwap(BucketIndex);	if (Bucket.Num() == 0) {		TurnBucket();	}	TSubclassOf<class AFlockingVehicle> Type = VehicleTypeClass[(uint8)VehicleType];	AFlockingVehicle* NewVehicle = GetWorld()->SpawnActor<AFlockingVehicle>(Type, GetActorLocation(), GetActorRotation(), spawnParameters);	NewVehicle->SetFlockingState(FlockingState);	NewVehicle->SpawnDefaultController();	NewVehicle->GetMesh()->SetAllPhysicsLinearVelocity(GetActorForwardVector() * StartSpeed / 0.036);	if (NewVehicle->VehicleType != VehicleType) {		GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("Vehicle Type is not correct."));	}	GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, GetTimeWait(), false);	if (VehicleTypeMaterials.Contains((uint8)VehicleType)) {		auto Materials = VehicleTypeMaterials[(uint8)VehicleType];		int32 Index = FMath::RandRange(0, Materials.Num() - 1);		UMaterial* Material = Materials[Index];		NewVehicle->GetMesh()->SetMaterial(2, Material);		NewVehicle->ColorMaterialIndex = Index;	}}
开发者ID:HighwayFlocking,项目名称:HighwayFlocking,代码行数:60,


示例3: GetNearbySocket

void 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,


示例4: GetActorLocation

void AGameplayAbilityWorldReticle::FaceTowardSource(bool bFaceIn2D){	if (TargetingActor)	{		if (bFaceIn2D)		{			FVector FacingVector = (TargetingActor->StartLocation.GetTargetingTransform().GetLocation() - GetActorLocation()).GetSafeNormal2D();			if (FacingVector.IsZero())			{				FacingVector = -GetActorForwardVector().GetSafeNormal2D();			}			if (!FacingVector.IsZero())			{				SetActorRotation(FacingVector.Rotation());			}		}		else		{			FVector FacingVector = (TargetingActor->StartLocation.GetTargetingTransform().GetLocation() - GetActorLocation()).GetSafeNormal();			if (FacingVector.IsZero())			{				FacingVector = -GetActorForwardVector().GetSafeNormal();			}			SetActorRotation(FacingVector.Rotation());		}	}}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:27,


示例5: GetActorForwardVector

bool ABaseCharacter::CanCharacterSprint()const{	FVector ForwardVector = GetActorForwardVector(); //normalized forward direction of the player	FVector VelocityVector = GetCharacterMovement()->Velocity.GetSafeNormal(); //the normalized direction in which the player is moving		bool IsMovingForward = false;	bool IsMovingOnRightVector = false;	float p = FVector::DotProduct(ForwardVector, VelocityVector); //cosine of angle between forward vector and velocity vector	//p = 1 if player is moving forward	//p = -1 if player is moving backward	//p = 0 if player is moving right or left	//we don't get exact values due to limited precision so check if p is nearly equal to 1, -1 or 0	if (p > 0.7f) //check if dot product is nearly one		IsMovingForward = true;	if (p < 0.1f) //check if dot product is nearly zero		IsMovingOnRightVector = true;		return !bIsCrouched && //Is not crouching		!GetCharacterMovement()->IsFalling() && //Is not Falling		(GetCharacterMovement()->Velocity.SizeSquared() != 0.0f) && //Is not sationary		IsMovingForward && //Is moving forward and not backward		!IsMovingOnRightVector; //Is NOT moving right or left	}
开发者ID:TheComet93,项目名称:iceweasel,代码行数:30,


示例6: MoveForward

void APawnCharacter::MoveForward(float AxisValue){	if (OurMovementComponent && (OurMovementComponent->UpdatedComponent == RootComponent))	{		OurMovementComponent->AddInputVector(GetActorForwardVector() * AxisValue);			}}
开发者ID:EliseSpPrj,项目名称:Descend,代码行数:7,


示例7: TEXT

void ACloud10Character::bounceJump(float Value){	float curJumpVelocity = Value;	float jumpVelocity;	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("bounceJump"));	const FVector ForwardDir = GetActorForwardVector();	/*bounceCount++;	if(bounceCount > 1)	{		jumpVelocity = jumpVelocity * 1.3;	}*/	//if player has landed, reset jumpVelocity	/*if (curJumpVelocity < baseJumpForce)		jumpVelocity = baseJumpForce;*/	//thresholds for jump velocity's that convert to force?	//max jump?	if (curJumpVelocity >= 3000)	{		curJumpVelocity = 3000;	}	//add only player's vertical speed to the last jump Velocity	jumpVelocity = FMath().Abs(curJumpVelocity) + baseJumpForce;	FVector AddForce = FVector(0, 0, 1) * jumpVelocity;	//separate max walk speed from max fall speed		//GetCharacterMovement()->MaxWalkSpeed = AddForce.Size();	//convert float to string	FString tempString = FString::SanitizeFloat(AddForce.Size());	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, *tempString);	LaunchCharacter(AddForce, false, true);	//bPressedJump = true;	//jumpVelocity = 600;}
开发者ID:KaroA,项目名称:Cloud-10,代码行数:33,


示例8: AddMovementInput

void AUModCharacter::MoveForward(float Value){    if (Value != 0.0f)    {        AddMovementInput(GetActorForwardVector(), Value);    }}
开发者ID:TheModdersDen,项目名称:UMod,代码行数:7,


示例9: FName

void 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,


示例10: GetActorForwardVector

void APlayerOvi::CalculateOrientation(){  FVector forward = GetActorForwardVector();  FVector up = GetActorUpVector();  float dotForward = FVector::DotProduct(GetActorLocation(), forward);  if (dotForward > m_limit && m_state == States::RIGHT)    Rotate(FVector(0, 0, -90));  if (dotForward > m_limit && m_state == States::LEFT)    Rotate(FVector(0, 0, 90));  float dotUp = FVector::DotProduct(GetActorLocation(), up);  float val = 0;  if (dotUp > m_limit || dotUp < -m_limit) {    bool toUp = dotUp > m_limit;    val = (toUp) ? 90 : -90;    if (m_state == States::RIGHT)      Rotate(FVector(-val, 0, 0));    else if (m_state == States::LEFT)      Rotate(FVector(val, 0, 0));  }  AjustPosition();}
开发者ID:alfreSosa,项目名称:TowardTheLight,代码行数:28,


示例11: AddMovementInput

void AUnreal4FPSGameCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:leiwen83,项目名称:Unreal4FPSGame,代码行数:8,


示例12: AddMovementInput

void ASterlingResortsCharacter::MoveForward(float Value){    if (Value != 0.0f)    {        // add movement in that direction        AddMovementInput(GetActorForwardVector(), Value);    }}
开发者ID:mukund-dh,项目名称:SterlingResorts,代码行数:8,


示例13: AddMovementInput

void AGestureRecognizerCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:abhisheksagi,项目名称:UE4-GestureRecognizers,代码行数:8,


示例14: AddMovementInpVR

void AGearVR_QSCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInpVR(GetActorForwardVector(), Value);	}}
开发者ID:LeeSeungJun,项目名称:VRModule-or-sample,代码行数:8,


示例15: AddMovementInput

void AInventoryPrototypeCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:drakemain,项目名称:UE4_Prototypes,代码行数:8,


示例16: AddMovementInput

void AShaderPluginDemoCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:alexgr,项目名称:UE4ShaderPluginDemo,代码行数:8,


示例17: AddMovementInput

void AMiniJamJuly2015Character::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:vikpek,项目名称:BerlinMiniJamJuly2015,代码行数:8,


示例18: AddMovementInput

void ASGJAM16_SPOOPYCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:KAGSme,项目名称:SGJAM16_SPOOPY,代码行数:8,


示例19: AddMovementInput

void AFP_FirstPersonCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// Add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:colwalder,项目名称:unrealengine,代码行数:8,


示例20: AddMovementInput

void AMobileOpenCVCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:brucelane,项目名称:UEMobileOpenCV,代码行数:8,


示例21: GetActorForwardVector

void APlayerCharacter::MoveForward(float val){	if (val != 0.0f)	{		FVector dir = GetActorForwardVector();		AddMovementInput(dir, val, false);	}}
开发者ID:Zyrst,项目名称:Run,代码行数:8,


示例22: AddMovementInput

void ATotemCharacter::MoveForward(float Value){	if (Value != 0.0f && bCanMove && bAcceptMoveInput)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value * MoveSpeedScale);	}}
开发者ID:whiteeat,项目名称:TotemCodeSample,代码行数:8,


示例23: GetActorForwardVector

void AAvatar::MoveForward(float amount){	if (Controller && amount)	{		FVector fwd = GetActorForwardVector();		AddMovementInput(fwd, amount);	}}
开发者ID:fredster1777,项目名称:maze,代码行数:8,


示例24: AddMovementInput

void AVertexColorSpreadCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:alanedwardes,项目名称:UE4VertexColorSpread,代码行数:8,


示例25: AddMovementInput

void AUDKPresentationCharacter::MoveForward(float Value){	if (Value != 0.0f)	{		// add movement in that direction		AddMovementInput(GetActorForwardVector(), Value);	}}
开发者ID:IronPeak,项目名称:UDKPresentation,代码行数:8,


示例26: AddMovementInput

// Handles the event when the MoveForward buttons are pressedvoid ASpectatorCharacter::MoveForward(float AxisValue){	if (AxisValue != 0.0f)	{		//UE_LOG(LogTemp, Warning, TEXT("Movement Pressed AxisValue = %f:"), AxisValue);		AddMovementInput(GetActorForwardVector(), AxisValue);	}}
开发者ID:akinlin,项目名称:POTM,代码行数:10,


示例27: AddMovementInput

/*Description: Moves the player forward and backwards*/void APoseidonCharacter::MoveForward(float value){	if (value != 0.0f && !mWasGrappleShot && !mCameraLock)	{		AddMovementInput(GetActorForwardVector(), value);		value = FMath::Abs(value);		PlayerController->ClientPlayCameraShake(HeadBobClass, value);		//ReportNoise("Event_PosStep", 0.0f);	}}
开发者ID:AndreaOsorio,项目名称:PSI,代码行数:11,


示例28: GetActorForwardVector

void AShip::calculateMovement(){	//GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, FString(engines));	FVector direction = GetActorForwardVector();	if (engines && engines->getThrottle() > 0){		direction.X *= engines->getThrottle() * engines->getPower();		direction.Z *= engines->getThrottle() * engines->getPower();		direction.Y += 0.f;		GetRootPrimitiveComponent()->AddForce(direction);	}}
开发者ID:Zecknaal,项目名称:Jettisoned,代码行数:10,


示例29: GetActorForwardVector

void AAvatar::MoveForward(float amount){  if (inventory_showing) { return; }  	if (Controller && amount)	{		FVector forward = GetActorForwardVector();		AddMovementInput(forward, amount);	}}
开发者ID:mdurn,项目名称:UnrealSample,代码行数:10,


示例30: GetActorRotation

void 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,



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


C++ GetActorLocation函数代码示例
C++ GetActor函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。