本文整理汇总了C++中GetActorForwardVector函数的典型用法代码示例。如果您正苦于以下问题:C++ GetActorForwardVector函数的具体用法?C++ GetActorForwardVector怎么用?C++ GetActorForwardVector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetActorForwardVector函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:MagnetTile.cpp
示例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,代码来源:CVehicleSpawner.cpp
示例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,代码来源:CoverActor.cpp
示例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,代码来源:GameplayAbilityWorldReticle.cpp
示例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,代码来源:BaseCharacter.cpp
示例6: MoveForward
void APawnCharacter::MoveForward(float AxisValue)
{
if (OurMovementComponent && (OurMovementComponent->UpdatedComponent == RootComponent))
{
OurMovementComponent->AddInputVector(GetActorForwardVector() * AxisValue);
}
}
开发者ID:EliseSpPrj,项目名称:Descend,代码行数:7,代码来源:PawnCharacter.cpp
示例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,代码来源:Cloud10Character.cpp
示例8: AddMovementInput
void AUModCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:TheModdersDen,项目名称:UMod,代码行数:7,代码来源:UModCharacter.cpp
示例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,代码来源:DuckTower.cpp
示例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,代码来源:PlayerOvi.cpp
示例11: AddMovementInput
void AUnreal4FPSGameCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:leiwen83,项目名称:Unreal4FPSGame,代码行数:8,代码来源:Unreal4FPSGameCharacter.cpp
示例12: AddMovementInput
void ASterlingResortsCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:mukund-dh,项目名称:SterlingResorts,代码行数:8,代码来源:SterlingResortsCharacter.cpp
示例13: AddMovementInput
void AGestureRecognizerCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:abhisheksagi,项目名称:UE4-GestureRecognizers,代码行数:8,代码来源:GestureRecognizerCharacter.cpp
示例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,代码来源:GearVR_QSCharacter.cpp
示例15: AddMovementInput
void AInventoryPrototypeCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:drakemain,项目名称:UE4_Prototypes,代码行数:8,代码来源:InventoryPrototypeCharacter.cpp
示例16: AddMovementInput
void AShaderPluginDemoCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:alexgr,项目名称:UE4ShaderPluginDemo,代码行数:8,代码来源:ShaderPluginDemoCharacter.cpp
示例17: AddMovementInput
void AMiniJamJuly2015Character::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:vikpek,项目名称:BerlinMiniJamJuly2015,代码行数:8,代码来源:MiniJamJuly2015Character.cpp
示例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,代码来源:SGJAM16_SPOOPYCharacter.cpp
示例19: AddMovementInput
void AFP_FirstPersonCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// Add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:8,代码来源:FP_FirstPersonCharacter.cpp
示例20: AddMovementInput
void AMobileOpenCVCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}
开发者ID:brucelane,项目名称:UEMobileOpenCV,代码行数:8,代码来源:MobileOpenCVCharacter.cpp
注:本文中的GetActorForwardVector函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论