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

C++ FRotationMatrix函数代码示例

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

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



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

示例1: FRotationMatrix

bool FEdModeGeometry::GetCustomDrawingCoordinateSystem( FMatrix& InMatrix, void* InData )
{
	if( GetSelectionState() == GSS_None )
	{
		return 0;
	}

	if( InData )
	{
		InMatrix = FRotationMatrix( ((FGeomBase*)InData)->GetNormal().Rotation() );
	}
	else
	{
		// If we don't have a specific geometry object to get the normal from
		// use the one that was last selected.

		for( int32 o = 0 ; o < GeomObjects.Num() ; ++o )
		{
			FGeomObject* go = GeomObjects[o];
			go->CompileSelectionOrder();

			if( go->SelectionOrder.Num() )
			{
				InMatrix = FRotationMatrix( go->SelectionOrder[ go->SelectionOrder.Num()-1 ]->GetWidgetRotation() );
				return 1;
			}
		}
	}

	return 0;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:31,代码来源:GeometryEdMode.cpp


示例2: SetBase

void ACharacter::PostNetReceiveBase()
{	
	const bool bBaseChanged = (RelativeMovement.MovementBase != MovementBase);
	if (bBaseChanged)
	{
		SetBase(RelativeMovement.MovementBase);
	}

	if (RelativeMovement.HasRelativePosition())
	{
		if (bBaseChanged || (RelativeMovement.Location != SavedRelativeLocation) || (RelativeMovement.Rotation != SavedRelativeRotation))
		{
			const FVector OldLocation = GetActorLocation();
			const FRotator NewRotation = (FRotationMatrix(RelativeMovement.Rotation) * FRotationMatrix(MovementBase->GetComponentRotation())).Rotator();
			SetActorLocationAndRotation( MovementBase->GetComponentLocation() + RelativeMovement.Location, NewRotation, false);

			INetworkPredictionInterface* PredictionInterface = InterfaceCast<INetworkPredictionInterface>(GetMovementComponent());
			if (PredictionInterface)
			{
				PredictionInterface->SmoothCorrection(OldLocation);
			}
		}
	}

	if ( CharacterMovement )
	{
		CharacterMovement->bJustTeleported = false;
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:29,代码来源:Character.cpp


示例3: UE_LOG

/**	Change the Pawn's base. */
void ACharacter::SetBase( UPrimitiveComponent* NewBaseComponent, bool bNotifyPawn )
{
	if (NewBaseComponent != MovementBase)
	{
		// Verify no recursion.
		APawn* Loop = (NewBaseComponent ? Cast<APawn>(NewBaseComponent->GetOwner()) : NULL);
		for(  ; Loop!=NULL; Loop=Cast<APawn>(Loop->GetMovementBase()) )
		{
			if( Loop == this )
			{
				UE_LOG(LogCharacter, Warning, TEXT(" SetBase failed! Recursion detected. Pawn %s already based on %s."), *GetName(), *NewBaseComponent->GetName());
				return;
			}
		}

		// Set base.
		MovementBase = NewBaseComponent;

		if (Role == ROLE_Authority)
		{
			// Update replicated value
			UE_LOG(LogCharacter, Verbose, TEXT("Setting base on server for '%s' to '%s'"), *GetName(), *GetFullNameSafe(NewBaseComponent));
			RelativeMovement.MovementBase = NewBaseComponent;
			RelativeMovement.bServerHasBaseComponent = (NewBaseComponent != NULL); // Flag whether the server had a non-null base.
		}
		else
		{
			UE_LOG(LogCharacter, Verbose, TEXT("Setting base on CLIENT for '%s' to '%s'"), *GetName(), *GetFullNameSafe(NewBaseComponent));
		}

		// Update relative location/rotation
		if ( Role == ROLE_Authority || Role == ROLE_AutonomousProxy )
		{
			if (MovementBaseUtility::UseRelativePosition(MovementBase))
			{
				RelativeMovement.Location = GetActorLocation() - MovementBase->GetComponentLocation();
				RelativeMovement.Rotation = (FRotationMatrix(GetActorRotation()) * FRotationMatrix(MovementBase->GetComponentRotation()).GetTransposed()).Rotator();
			}
		}

		// Notify this actor of his new floor.
		if ( bNotifyPawn )
		{
			BaseChange();
		}

		if (MovementBase && CharacterMovement)
		{
			// Update OldBaseLocation/Rotation as those were referring to a different base
			CharacterMovement->OldBaseLocation = MovementBase->GetComponentLocation();
			CharacterMovement->OldBaseRotation = MovementBase->GetComponentRotation();
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:55,代码来源:Character.cpp


示例4: GetOuterAPlayerController

void UCheatManager::DamageTarget(float DamageAmount)
{
	APlayerController* const MyPC = GetOuterAPlayerController();
	if ((MyPC == NULL) || (MyPC->PlayerCameraManager == NULL))
	{
		return;
	}

	check(GetWorld() != NULL);
	FVector const CamLoc = MyPC->PlayerCameraManager->GetCameraLocation();
	FRotator const CamRot = MyPC->PlayerCameraManager->GetCameraRotation();

	FCollisionQueryParams TraceParams(NAME_None, true, MyPC->GetPawn());
	FHitResult Hit;
	bool bHit = GetWorld()->LineTraceSingle(Hit, CamLoc, CamRot.Vector() * 100000.f + CamLoc, ECC_Pawn, TraceParams);
	if (bHit)
	{
		check(Hit.GetActor() != NULL);
		FVector ActorForward, ActorSide, ActorUp;
		FRotationMatrix(Hit.GetActor()->GetActorRotation()).GetScaledAxes(ActorForward, ActorSide, ActorUp);

		FPointDamageEvent DamageEvent(DamageAmount, Hit, -ActorForward, UDamageType::StaticClass());
		Hit.GetActor()->TakeDamage(DamageAmount, DamageEvent, MyPC, MyPC->GetPawn());
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:25,代码来源:CheatManager.cpp


示例5: FRotationMatrix

void AFPSGCharacter::moveRight(float moveValue)
{
	//Dont execute this input if the in game menu is open
	if (isInGameMenuOpen()) return;

	if (Controller != NULL && moveValue != 0.0f)
	{
		//Retrieve the viewing/aiming direction of the controlled pawn
		FRotator rotation = Controller->GetControlRotation();

		//Move the character
		const FVector moveDirection = FRotationMatrix(rotation).GetScaledAxis(EAxis::Y);
		AddMovementInput(moveDirection, moveValue);

		if (moveValue == 1.0f)
		{
			if (movementDirection != EMoveDirection::RIGHT)
			{
				serverUpdateMovementDirection(static_cast<uint8>(EMoveDirection::RIGHT));
			}
		}
		if (moveValue == -1.0f)
		{
			if (movementDirection != EMoveDirection::LEFT)
			{
				serverUpdateMovementDirection(static_cast<uint8>(EMoveDirection::LEFT));
			}
		}
	}
}
开发者ID:Gardern,项目名称:FPSGame_code,代码行数:30,代码来源:FPSGCharacter.cpp


示例6: FRotationTranslationMatrix

void ANimModCharacter::OnCameraUpdate(const FVector& PreviousCameraLocation, const FVector& CameraLocation, const FRotator& CameraRotation)
{
	USkeletalMeshComponent* DefMesh1P = Cast<USkeletalMeshComponent>(GetClass()->GetDefaultSubobjectByName(TEXT("PawnMesh1P")));
	//USkeletalMeshComponent* DefMesh1P = Mesh1P;
	const FMatrix DefMeshLS = FRotationTranslationMatrix(DefMesh1P->RelativeRotation, DefMesh1P->RelativeLocation);
	const FMatrix LocalToWorld = ActorToWorld().ToMatrixWithScale();

	// Mesh rotating code expect uniform scale in LocalToWorld matrix

	const FRotator RotCameraPitch(CameraRotation.Pitch, 0.0f, 0.0f);
	const FRotator RotCameraYaw(0.0f, CameraRotation.Yaw, 0.0f);

	const FMatrix LeveledCameraLS = FRotationTranslationMatrix(RotCameraYaw, CameraLocation) * LocalToWorld.Inverse();
	const FMatrix PitchedCameraLS = FRotationMatrix(RotCameraPitch) * LeveledCameraLS;
	const FMatrix MeshRelativeToCamera = DefMeshLS * LeveledCameraLS.Inverse();
	const FMatrix PitchedMesh = MeshRelativeToCamera * PitchedCameraLS;

	//FVector origin = PitchedMesh.GetOrigin();
	FVector origin = Mesh1P->GetRelativeTransform().GetLocation();
	//FVector originalLocation = Mesh1P->GetRelativeTransform().GetLocation();
	////FVector origin = Mesh1P->ComponentToWorld.GetLocation();
	//if (bIsCrouched)
	//{
	//	//origin.Z = (origin.Z - (DefaultBaseEyeHeight - DefMesh1P->RelativeLocation.Z));
	//	origin.Z = (PreviousCameraLocation.Z - CameraLocation.Z);
	//}

	Mesh1P->SetRelativeLocationAndRotation(origin, PitchedMesh.Rotator(), false, nullptr, ETeleportType::TeleportPhysics);
	/*FVector newLocation = Mesh1P->GetRelativeTransform().GetLocation();
	int i = -1;*/
}
开发者ID:Nimgoble,项目名称:NimMod,代码行数:31,代码来源:NimModCharacter.cpp


示例7: YawRotation

void ACoverSystemCharacter::MoveRight(float Value)
{
	//for the animation bp
	CoverValue = Value;

	if ((Controller != NULL) && (Value != 0.0f))
	{
		if (!bIsInCover)
		{
			//default movement functionality

			// find out which way is right
			const FRotator Rotation = Controller->GetControlRotation();
			const FRotator YawRotation(0, Rotation.Yaw, 0);

			// get right vector 
			FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
			AddMovementInput(Direction, Value);
		}
		else
		{
			//Move according to the cover actor's position
			AddMovementInput(CoverDirectionMovement, Value);
		}
	}
}
开发者ID:orfeasel,项目名称:UE4-Game-Systems,代码行数:26,代码来源:CoverSystemCharacter.cpp


示例8: GetActorLocation

// Called every frame
void AMonster::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

	ARaiderCharacter *avatar = Cast<ARaiderCharacter>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
	if (!avatar) return;
	FVector toPlayer = avatar->GetActorLocation() -	GetActorLocation();
	
	this->GetCharacterMovement()->bOrientRotationToMovement = true; // Rotate character to moving direction

	float distanceToPlayer = toPlayer.Size();
	// If the player is not in the SightSphere of the monster,
	// go back
	if (distanceToPlayer > SightSphere->GetScaledSphereRadius())
	{
		// If the player is out of sight,
		// then the enemy cannot chase
		return;
	}
	toPlayer /= distanceToPlayer; // normalizes the vector
	
	FRotator Rotation = toPlayer.Rotation();
	const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
	AddMovementInput(Direction, m_fSpeed * DeltaTime);
}
开发者ID:damorton,项目名称:raider,代码行数:26,代码来源:Monster.cpp


示例9: bInBaseReplicationGuard

void ACharacter::OnRep_ReplicatedBasedMovement()
{
    if (Role != ROLE_SimulatedProxy)
    {
        return;
    }

    // Skip base updates while playing root motion, it is handled inside of OnRep_RootMotion
    if (IsPlayingNetworkedRootMotionMontage())
    {
        return;
    }

    TGuardValue<bool> bInBaseReplicationGuard(bInBaseReplication, true);

    const bool bBaseChanged = (BasedMovement.MovementBase != ReplicatedBasedMovement.MovementBase || BasedMovement.BoneName != ReplicatedBasedMovement.BoneName);
    if (bBaseChanged)
    {
        // Even though we will copy the replicated based movement info, we need to use SetBase() to set up tick dependencies and trigger notifications.
        SetBase(ReplicatedBasedMovement.MovementBase, ReplicatedBasedMovement.BoneName);
    }

    // Make sure to use the values of relative location/rotation etc from the server.
    BasedMovement = ReplicatedBasedMovement;

    if (ReplicatedBasedMovement.HasRelativeLocation())
    {
        // Update transform relative to movement base
        const FVector OldLocation = GetActorLocation();
        const FQuat OldRotation = GetActorQuat();
        MovementBaseUtility::GetMovementBaseTransform(ReplicatedBasedMovement.MovementBase, ReplicatedBasedMovement.BoneName, CharacterMovement->OldBaseLocation, CharacterMovement->OldBaseQuat);
        const FVector NewLocation = CharacterMovement->OldBaseLocation + ReplicatedBasedMovement.Location;

        if (ReplicatedBasedMovement.HasRelativeRotation())
        {
            // Relative location, relative rotation
            FRotator NewRotation = (FRotationMatrix(ReplicatedBasedMovement.Rotation) * FQuatRotationMatrix(CharacterMovement->OldBaseQuat)).Rotator();

            // TODO: need a better way to not assume we only use Yaw.
            NewRotation.Pitch = 0.f;
            NewRotation.Roll = 0.f;

            SetActorLocationAndRotation(NewLocation, NewRotation);
        }
        else
        {
            // Relative location, absolute rotation
            SetActorLocationAndRotation(NewLocation, ReplicatedBasedMovement.Rotation);
        }

        // When position or base changes, movement mode will need to be updated. This assumes rotation changes don't affect that.
        CharacterMovement->bJustTeleported |= (bBaseChanged || GetActorLocation() != OldLocation);

        INetworkPredictionInterface* PredictionInterface = Cast<INetworkPredictionInterface>(GetMovementComponent());
        if (PredictionInterface)
        {
            PredictionInterface->SmoothCorrection(OldLocation, OldRotation);
        }
    }
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:60,代码来源:Character.cpp


示例10: GetActorRotation

void ACloud10Character::MoveForward(float Value)
{
	if (isDiving)
	{
		float prevPitch = GetActorRotation().Pitch;
		float minDeltaPitch = minPitch - prevPitch;
		float maxDeltaPitch = maxPitch - prevPitch;
		//roll character in an angle front and back
		float curPitchAmt = Value;
		FRotator dRotation(0,0,0);
		dRotation.Pitch = FMath::ClampAngle(curPitchAmt * rotationRate, minDeltaPitch, maxDeltaPitch);
		AddActorLocalRotation(dRotation);
	}
	else
	{
		if ((Controller != NULL) && (Value != 0.0f))
		{
			// find out which way is forward
			const FRotator Rotation = Controller->GetControlRotation();
			const FRotator YawRotation(0, Rotation.Yaw, 0);

			// get forward vector
			const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
			AddMovementInput(Direction, Value);
		}
	}

}
开发者ID:KaroA,项目名称:Cloud-10,代码行数:28,代码来源:Cloud10Character.cpp


示例11: RotateRight

void AKIMCharacter::MoveRight(float Value) {
	if (Value < -0.09f || Value > 0.09f) {
		if (IsInRoationState) {
			RotateRight(Value*10);
			return;
		}
		if (PickedUpItem) {
			if (Value < -0.09f) {
				Value += FMath::Clamp((((AKIMInteractionActor*)PickedUpItem)->Weight / 100), 0.f, abs(Value));
			}
			else if (Value > 0.09f) {
				Value -= FMath::Clamp((((AKIMInteractionActor*)PickedUpItem)->Weight / 100), 0.f,  abs(Value));
			}
			else return;
		}

		//Value *= MovementSpeed;

		// 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);
		// add movement in that direction
		AddMovementInput(Direction, Value);
	}
}
开发者ID:JackHarb89,项目名称:KIM,代码行数:28,代码来源:KIMCharacter.cpp


示例12: GetBaseAimRotation

void AARCharacter::MoveForward(float Value)
{
	if ((Controller != NULL) && (Value != 0.0f))
	{
		//if (Value < 0)
		//{
		//	float orignal = CharacterMovement->MaxWalkSpeed;
		//	CharacterMovement->MaxWalkSpeed = CharacterMovement->MaxWalkSpeed / 2;
		//	FRotator Rotation = GetBaseAimRotation();

		//	FVector Location; //not used, just need for below.
		//	//Controller->GetPlayerViewPoint(Location, Rotation);
		//	Rotation.Normalize();
		//	FRotator YawRotation(0, Rotation.Yaw, 0);
		//	//const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis( EAxis::X );
		//	const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
		//	AddMovementInput(Direction, Value);
		//	CharacterMovement->MaxWalkSpeed = orignal;
		//	return;
		//}
		FRotator Rotation = GetBaseAimRotation();

		FVector Location; //not used, just need for below.
		//Controller->GetPlayerViewPoint(Location, Rotation);
		Rotation.Normalize();
		FRotator YawRotation(0, Rotation.Yaw, 0);
		//const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis( EAxis::X );
		const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
		AddMovementInput(Direction, Value);
	}
}
开发者ID:Aboutdept,项目名称:ActionRPGGame,代码行数:31,代码来源:ARCharacter.cpp


示例13: YawRotation

void AZombieShooterCharacter::MoveUp(float Value)
{
	const FRotator Rotation = TopDownCameraComponent->GetComponentRotation();
	const FRotator YawRotation(0.0f, Rotation.Yaw, 0.0f);

	const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
	AddMovementInput(Direction, Value);
}
开发者ID:DisposedCheese,项目名称:ZombieShooter,代码行数:8,代码来源:ZombieShooterCharacter.cpp


示例14: YawRotation

void ABrainCharacter::MoveSide(float value)
{
	const FRotator Rotation = Cast<ABrainPlayerController>(Controller)->GetCameraRotation();
	const FRotator YawRotation(0, Rotation.Yaw, 0);

	const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
	AddMovementInput(Direction, value);
}
开发者ID:gamer08,项目名称:Brain,代码行数:8,代码来源:BrainCharacter.cpp


示例15: YawRotation

void AKIMCharacter::MoveForward(float Value) {
	// find out which way is forward
	const FRotator Rotation = Controller->GetControlRotation();
	const FRotator YawRotation(0, Rotation.Yaw, 0);

	// get forward vector
	const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
	AddMovementInput(Direction, Value);
}
开发者ID:JackHarb89,项目名称:GA2015WSPitch,代码行数:9,代码来源:KIMCharacter.cpp


示例16: GetActorRotation

void ANimModCharacter::MoveRight(float Val)
{
	if (Val != 0.f)
	{
		const FRotator Rotation = GetActorRotation();
		const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
		AddMovementInput(Direction, Val);
	}
}
开发者ID:Nimgoble,项目名称:NimMod,代码行数:9,代码来源:NimModCharacter.cpp


示例17: GetActorRotation

/**
*	MOVEMENT FUNCTION
*	Check If player exists, get rotation value of player. Gets direction to move in.
*	Move in direction by Value passed in.
*
*	@param Rate to move
*	@return void
**/
void APlayerCharacter::MoveLeftRight(float Value)
{
	if (Value != 0.0f)
	{
		FRotator const Rotation = GetActorRotation();
		FVector const Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
		AddMovementInput(Direction, Value);
	}
}
开发者ID:jackdurnford,项目名称:MidnightSnag,代码行数:17,代码来源:PlayerCharacter.cpp


示例18: FRotationMatrix

void ABrowserCharacter::MoveRight(float Val)
{
	if ((Val != 0.0f) && (Controller != NULL))
	{
		const FRotator Rotation = Controller->GetControlRotation();
		const FRotationMatrix R = FRotationMatrix(FRotator(0, Rotation.Yaw, 0));
		const FVector WorldSpaceAccel = R.GetScaledAxis(EAxis::Y);
		AddMovementInput(WorldSpaceAccel, Val * SpeedY * (CHARACTER_MOVEMENT_SPEED(cameraZoom_current)));
	}
}
开发者ID:skeru,项目名称:ambif,代码行数:10,代码来源:BrowserCharacter.cpp


示例19: FRotationMatrix

void AsbrPlayer::MoveRight(float value)
{
    if ((Controller != NULL) && (value != 0.0f))
    {
        const FRotator Rotation = Controller->GetControlRotation();
        const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);

        AddMovementInput(Direction, value);
    }
}
开发者ID:alebaster,项目名称:sbr,代码行数:10,代码来源:sbrPlayer.cpp


示例20: YawRotation

void ATopDown_HitmanCleanCharacter::MoveForward(float Value){
	if ((Controller != NULL) && (Value != 0.0f)){
		// find out which way is forward
		const FRotator Rotation = Controller->GetControlRotation();
		const FRotator YawRotation(0, Rotation.Yaw, 0);

		// get forward vector
		const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
		AddMovementInput(Direction, Value);
	}
}
开发者ID:esphung,项目名称:hitman-clean_prototype,代码行数:11,代码来源:TopDown_HitmanCleanCharacter.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FRotator函数代码示例发布时间:2022-05-30
下一篇:
C++ FResolveParams函数代码示例发布时间: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