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


C++ FRotator::RotateVector方法代码示例

本文整理汇总了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;
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:57,代码来源:EditorCsg.cpp

示例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);
	}
}
开发者ID:eternalst0rm,项目名称:ClashOfBalls,代码行数:13,代码来源:ClashOfBallsBall.cpp

示例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);
		}
	}

}
开发者ID:brucelane,项目名称:UEMobileOpenCV,代码行数:35,代码来源:MobileOpenCVCharacter.cpp

示例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;
		}
	}
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:32,代码来源:TP_TwinStickPawn.cpp

示例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;
}
开发者ID:AlexZhangji,项目名称:ShootingStar,代码行数:28,代码来源:ITP380_RocketThingPawn.cpp

示例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);
        }
    }
}
开发者ID:Roger7410,项目名称:Fournoid,代码行数:26,代码来源:PlayerCharacter.cpp

示例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;
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:45,代码来源:InterpToMovementComponent.cpp

示例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);
	}
}
开发者ID:7hny,项目名称:leap-ue4,代码行数:12,代码来源:AnimBone.cpp

示例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);
}
开发者ID:ArchDD,项目名称:Archs-HairyLab-UE4,代码行数:12,代码来源:Hair.cpp

示例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);
}
开发者ID:ntorkildson,项目名称:EpicSurvivalGameSeries,代码行数:15,代码来源:SCarryObjectComponent.cpp

示例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);
				}
		}
}
开发者ID:kcnklub,项目名称:In-The-Palms3d,代码行数:15,代码来源:HunterMarxo.cpp

示例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);
		}
	}

}
开发者ID:whiteeat,项目名称:TotemCodeSample,代码行数:43,代码来源:TotemCharacter.cpp

示例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();
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:42,代码来源:ActorEditor.cpp

示例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);
		}
	}

}
开发者ID:IronPeak,项目名称:UDKPresentation,代码行数:42,代码来源:UDKPresentationCharacter.cpp

示例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--;
		}
}
开发者ID:kcnklub,项目名称:In-The-Palms3d,代码行数:21,代码来源:HunterMarxo.cpp


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