本文整理汇总了C++中FRotator::RotateVector方法的典型用法代码示例。如果您正苦于以下问题:C++ FRotator::RotateVector方法的具体用法?C++ FRotator::RotateVector怎么用?C++ FRotator::RotateVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRotator
的用法示例。
在下文中一共展示了FRotator::RotateVector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void UEditorEngine::polyUpdateMaster
(
UModel* Model,
int32 iSurf,
int32 UpdateTexCoords
)
{
FBspSurf &Surf = Model->Surfs[iSurf];
ABrush* Actor = Surf.Actor;
if( !Actor )
return;
UModel* Brush = Actor->Brush;
check(Brush);
FVector ActorLocation;
FVector ActorPrePivot;
FVector ActorScale;
FRotator ActorRotation;
if (Brush->bCachedOwnerTransformValid)
{
// Use transform cached when the geometry was last built, in case the current Actor transform has changed since then
// (e.g. because Auto Update BSP is disabled)
ActorLocation = Brush->OwnerLocationWhenLastBuilt;
ActorPrePivot = Brush->OwnerPrepivotWhenLastBuilt;
ActorScale = Brush->OwnerScaleWhenLastBuilt;
ActorRotation = -Brush->OwnerRotationWhenLastBuilt;
}
else
{
// No cached owner transform, so use the current one
ActorLocation = Actor->GetActorLocation();
ActorPrePivot = Actor->GetPrePivot();
ActorScale = Actor->GetActorScale();
ActorRotation = -Actor->GetActorRotation();
}
for( int32 iEdPoly = Surf.iBrushPoly; iEdPoly < Brush->Polys->Element.Num(); iEdPoly++ )
{
FPoly& MasterEdPoly = Brush->Polys->Element[iEdPoly];
if( iEdPoly==Surf.iBrushPoly || MasterEdPoly.iLink==Surf.iBrushPoly )
{
MasterEdPoly.Material = Surf.Material;
MasterEdPoly.PolyFlags = Surf.PolyFlags & ~(PF_NoEdit);
if( UpdateTexCoords )
{
MasterEdPoly.Base = ActorRotation.RotateVector(Model->Points[Surf.pBase] - ActorLocation) / ActorScale + ActorPrePivot;
MasterEdPoly.TextureU = ActorRotation.RotateVector(Model->Vectors[Surf.vTextureU]) * ActorScale;
MasterEdPoly.TextureV = ActorRotation.RotateVector(Model->Vectors[Surf.vTextureV]) * ActorScale;
}
}
}
Model->InvalidSurfaces = true;
}
示例2: AddMovement_Implementation
void AClashOfBallsBall::AddMovement_Implementation(bool ForwardBackward, float Value, FRotator Rotation)
{
if (ForwardBackward)
{
const FVector Torque = Rotation.RotateVector(FVector(0, Value * RollTorque, 0.f));
Ball->AddTorque(Torque);
}
else
{
const FVector Torque = Rotation.RotateVector(FVector(-1 * Value * RollTorque, 0.f, 0.f));
Ball->AddTorque(Torque);
}
}
示例3: OnFire
void AMobileOpenCVCharacter::OnFire()
{
// try and fire a projectile
if (ProjectileClass != NULL)
{
const FRotator SpawnRotation = GetControlRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset);
UWorld* const World = GetWorld();
if (World != NULL)
{
// spawn the projectile at the muzzle
World->SpawnActor<AMobileOpenCVProjectile>(ProjectileClass, SpawnLocation, SpawnRotation);
}
}
// try and play the sound if specified
if (FireSound != NULL)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}
// try and play a firing animation if specified
if(FireAnimation != NULL)
{
// Get the animation object for the arms mesh
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if(AnimInstance != NULL)
{
AnimInstance->Montage_Play(FireAnimation, 1.f);
}
}
}
示例4: FireShot
void ATP_TwinStickPawn::FireShot(FVector FireDirection)
{
// If we it's ok to fire again
if (bCanFire == true)
{
// If we are pressing fire stick in a direction
if (FireDirection.SizeSquared() > 0.0f)
{
const FRotator FireRotation = FireDirection.Rotation();
// Spawn projectile at an offset from this pawn
const FVector SpawnLocation = GetActorLocation() + FireRotation.RotateVector(GunOffset);
UWorld* const World = GetWorld();
if (World != NULL)
{
// spawn the projectile
World->SpawnActor<ATP_TwinStickProjectile>(SpawnLocation, FireRotation);
}
bCanFire = false;
World->GetTimerManager().SetTimer(TimerHandle_ShotTimerExpired, this, &ATP_TwinStickPawn::ShotTimerExpired, FireRate);
// try and play the sound if specified
if (FireSound != nullptr)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}
bCanFire = false;
}
}
}
示例5: GetWorld
void AITP380_RocketThingPawn::FireCluster(){
UWorld* const World = GetWorld();
for (int k = 0; k < NumFiredAtOnce; k++){
FRotator FireRotation = curFireDirection.Rotation();
FRotator randRotation = FRotator(FireRotation.Pitch, FireRotation.Yaw + FMath::RandRange(-90, 90), FireRotation.Roll);
// Spawn projectile at an offset from this pawn
const FVector SpawnLocation = GetActorLocation() + randRotation.RotateVector(GunOffset);
if (World != NULL)
{
// spawn the projectile
ARocketProjectile* projectile = World->SpawnActor<ARocketProjectile>(SpawnLocation, randRotation);
projectile->targetDirection = FireRotation.Vector();
}
//bCanFire = false;
// try and play the sound if specified
}
World->GetTimerManager().SetTimer(TimerHandle_ShotTimerExpired, this, &AITP380_RocketThingPawn::ShotTimerExpired, FireRate);
projectilesFired += NumFiredAtOnce;
if (projectilesFired < NumFiredTotal)
World->GetTimerManager().SetTimer(TimerHandle_ShotIntervalExpired, this, &AITP380_RocketThingPawn::FireCluster, pauseBetweenFires);
else
projectilesFired = 0;
}
示例6: SpawnKeeper
void APlayerCharacter::SpawnKeeper()
{
if (Role < ROLE_Authority)
{
return;
}
// try and fire a projectile
if (KeeperClass)
{
FournoidUtils::BlueMessage(TEXT("Spwaning Keeper"));
// Get the actors rotation caused by control in world space.
const FRotator SpawnRotation = GetControlRotation();
// Tarnsform the SpawnOffset from local space to world space.
const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(SpawnOffset);
UWorld* const World = GetWorld();
if (World)
{
FournoidUtils::BlueMessage(TEXT("Spwaning..."));
// spawn the projectile at the muzzle
auto SpawnedKeeper = World->SpawnActor<AFournoidKeeper>(KeeperClass, SpawnLocation, SpawnRotation);
SpawnedKeeper->SetKeeperMaster(this);
}
}
}
示例7: ComputeMoveDelta
FVector UInterpToMovementComponent::ComputeMoveDelta(float InTime) const
{
FVector MoveDelta = FVector::ZeroVector;
FVector NewPosition = FVector::ZeroVector;
//Find current control point
float Time = 0.0f;
int32 CurrentControlPoint = INDEX_NONE;
// Always use the end point if we are at the end
if (InTime >= 1.0f)
{
CurrentControlPoint = ControlPoints.Num() - 1;
}
else
{
for (int32 iSpline = 0; iSpline < ControlPoints.Num(); iSpline++)
{
float NextTime = Time + ControlPoints[iSpline].Percentage;
if (InTime < NextTime)
{
CurrentControlPoint = iSpline;
break;
}
Time = NextTime;
}
}
// If we found a valid control point get the position between it and the next
if (CurrentControlPoint != INDEX_NONE)
{
FRotator CurrentRotation = UpdatedComponent->GetComponentRotation();
float Base = InTime - ControlPoints[CurrentControlPoint].StartTime;
float ThisAlpha = Base / ControlPoints[CurrentControlPoint].Percentage;
FVector BeginControlPoint = ControlPoints[CurrentControlPoint].PositionControlPoint;
BeginControlPoint = CurrentRotation.RotateVector(BeginControlPoint) + ( ControlPoints[CurrentControlPoint].bPositionIsRelative == true ? StartLocation : FVector::ZeroVector);
int32 NextControlPoint = FMath::Clamp(CurrentControlPoint + 1, 0, ControlPoints.Num() - 1);
FVector EndControlPoint = ControlPoints[NextControlPoint].PositionControlPoint;
EndControlPoint = CurrentRotation.RotateVector(EndControlPoint) + ( ControlPoints[NextControlPoint].bPositionIsRelative == true ? StartLocation : FVector::ZeroVector);
NewPosition = FMath::Lerp(BeginControlPoint, EndControlPoint, ThisAlpha);
}
FVector CurrentPosition = UpdatedComponent->GetComponentLocation();
MoveDelta = NewPosition - CurrentPosition;
return MoveDelta;
}
示例8: ChangeBasis
void UAnimBone::ChangeBasis(FRotator PreBase, FRotator PostBase, bool AdjustVectors)
{
//Adjust the orientation
FRotator PostCombine = CombineRotators(Orientation, PostBase);
Orientation = CombineRotators(PreBase, PostCombine);
//Rotate our vector/s
if (AdjustVectors)
{
Position = PostBase.RotateVector(Position);
}
}
示例9: SetNodeRotation
void AHair::SetNodeRotation(AHairNode* Node, FRotator Rotation, bool IsPropToChildren)
{
AHairSegment* Segment = Node->Segment;
USplineComponent* Spline = Segment->Spline;
FVector Up = Spline->GetUpVectorAtSplinePoint(Node->Index, ESplineCoordinateSpace::World);
FVector UpRotated = Rotation.RotateVector(Up);
Spline->SetUpVectorAtSplinePoint(Node->Index, UpRotated, ESplineCoordinateSpace::World);
Node->SetActorRotation(Spline->GetRotationAtSplinePoint(Node->Index, ESplineCoordinateSpace::World));
UpdateSegment(Segment);
}
示例10: RotateActorAroundPoint
void USCarryObjectComponent::RotateActorAroundPoint(AActor* RotateActor, FVector RotationPoint, FRotator AddRotation)
{
FVector Loc = RotateActor->GetActorLocation() - RotationPoint;
FVector RotatedLoc = AddRotation.RotateVector(Loc);
FVector NewLoc = RotationPoint + RotatedLoc;
/* Compose the rotators, use Quats to avoid gimbal lock */
FQuat AQuat = FQuat(RotateActor->GetActorRotation());
FQuat BQuat = FQuat(AddRotation);
FRotator NewRot = FRotator(BQuat*AQuat);
RotateActor->SetActorLocationAndRotation(NewLoc, NewRot);
}
示例11: ThrowSmokeGrenade
void AHunterMarxo::ThrowSmokeGrenade()
{
if (!bSmokeGrenadeIsOnCD && SmokeGrenade != NULL)
{
SmokeGrenade->GetDefaultObject<ABasicProjectile>()->SetDamage(0.f);
const FRotator SpawnRotation = CameraArm->GetComponentRotation();
const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(SmokeGrenadeOffset);
UWorld* const World = GetWorld();
if (World != NULL)
{
World->SpawnActor<ABasicProjectile>(SmokeGrenade, SpawnLocation, SpawnRotation);
}
}
}
示例12: OnFire
void ATotemCharacter::OnFire()
{
//only server can spawn projectile theoretically
// try and fire a projectile
if (ProjectileClass != NULL || FireProjectileClass != NULL)
{
const FRotator SpawnRotation = GetControlRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset);
UWorld* const World = GetWorld();
if (World != NULL)
{
//to add owner and instigator information
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = Cast<ATotemPlayerController>(Controller);
SpawnParams.Instigator = Instigator;
//When the server function is called by serve, it also execute.
ServerSpawnProjectile(SpawnLocation, SpawnRotation, SpawnParams.Owner, SpawnParams.Instigator);
// spawn the projectile at the muzzle single player version
//World->SpawnActor<ATotemProjectile>(ProjectileClass, SpawnLocation, SpawnRotation, SpawnParams);
}
}
// try and play the sound if specified
if (FireSound != NULL)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}
// try and play a firing animation if specified
if (FireAnimation != NULL)
{
// Get the animation object for the arms mesh
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if (AnimInstance != NULL)
{
AnimInstance->Montage_Play(FireAnimation, 1.f);
}
}
}
示例13: EditorApplyScale
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);
const FRotator ActorRotation = GetActorRotation();
const FVector WorldDelta = GetActorLocation() - (*PivotLocation);
const FVector LocalDelta = (ActorRotation.GetInverse()).RotateVector(WorldDelta);
const FVector LocalScaledDelta = LocalDelta * (ScaleToApply / CurrentScaleSafe);
const FVector WorldScaledDelta = ActorRotation.RotateVector(LocalScaledDelta);
GetRootComponent()->SetWorldLocation(WorldScaledDelta + (*PivotLocation));
}
}
else
{
UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyTranslation %s has no root component"), *GetName() );
}
FEditorSupportDelegates::UpdateUI.Broadcast();
}
示例14: OnFire
void AUDKPresentationCharacter::OnFire()
{
if (CharacterMovement->IsMovingOnGround()) {
ammo = maxAmmo;
}
if (ammo <= 0) return;
// try and fire a projectile
if (ProjectileClass != NULL)
{
const FRotator SpawnRotation = GetControlRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset);
ammo--;
CharacterMovement->Velocity = GetControlRotation().Vector()*(-1000) + 0.5f * CharacterMovement->Velocity;
UWorld* const World = GetWorld();
if (World != NULL)
{
// spawn the projectile at the muzzle
World->SpawnActor<AUDKPresentationProjectile>(ProjectileClass, SpawnLocation, SpawnRotation);
}
}
// try and play the sound if specified
if (FireSound != NULL)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}
// try and play a firing animation if specified
if(FireAnimation != NULL)
{
// Get the animation object for the arms mesh
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if(AnimInstance != NULL)
{
AnimInstance->Montage_Play(FireAnimation, 1.f);
}
}
}
示例15: Attack
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--;
}
}