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


C++ FVector::Normalize方法代码示例

本文整理汇总了C++中FVector::Normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::Normalize方法的具体用法?C++ FVector::Normalize怎么用?C++ FVector::Normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FVector的用法示例。


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

示例1: RunDetection

void UActorDetectorComponent::RunDetection()
{
	TArray<AActor*> OverlappingActors;
	GetOwner()->GetOverlappingActors(OverlappingActors);

	if (OverlappingActors.Num() > 0)
	{
		for (size_t i = 0; i < OverlappingActors.Num(); i++)
		{
			if (OverlappingActors[i]->ActorHasTag(TagToDetect))
			{
				// Get directions
				FVector OwnerDirection = GetOwner()->GetActorForwardVector();
				FVector ActorDirection = OverlappingActors[i]->GetActorLocation() - GetOwner()->GetActorLocation();

				// Normalize vectors
				OwnerDirection.Normalize();
				ActorDirection.Normalize();

				// Calculate angle
				float AngleFromForward = FMath::RadiansToDegrees(acosf(FVector::DotProduct(OwnerDirection, ActorDirection)));
				if (AngleFromForward < MaxAngleDetection)
				{
					//UE_LOG(LogTemp, Warning, TEXT("Lanzo Broadcast"));
					ActorDetected.Broadcast(OverlappingActors[i]);
				}
				//UE_LOG(LogTemp, Warning, TEXT("Tiene tag Name: %s y angulo %f, max %f"), *(OverlappingActors[i]->GetName()), AngleFromForward, MaxAngleDetection);
			}
		}
	}
}
开发者ID:chrislugram,项目名称:SpaceHunting,代码行数:31,代码来源:ActorDetectorComponent.cpp

示例2: GetGameplayCueDirection

bool UAbilitySystemBlueprintLibrary::GetGameplayCueDirection(AActor* TargetActor, FGameplayCueParameters Parameters, FVector& Direction)
{
	if (FGameplayEffectContext* Ctx = Parameters.EffectContext.Get())
	{
		if (Ctx->GetHitResult())
		{
			// Most projectiles and melee attacks will use this
			Direction = (-1.f * Ctx->GetHitResult()->Normal);
			return true;
		}
		else if (TargetActor && Ctx->HasOrigin())
		{
			// Fallback to trying to use the target location and the origin of the effect
			FVector NewVec = (TargetActor->GetActorLocation() - Ctx->GetOrigin());
			NewVec.Normalize();
			Direction = NewVec;
			return true;
		}
		else if (TargetActor && Ctx->GetEffectCauser())
		{
			// Finally, try to use the direction between the causer of the effect and the target of the effect
			FVector NewVec = (TargetActor->GetActorLocation() - Ctx->GetEffectCauser()->GetActorLocation());
			NewVec.Normalize();
			Direction = NewVec;
			return true;
		}
	}

	Direction = FVector::ZeroVector;
	return false;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:31,代码来源:AbilitySystemBlueprintLibrary.cpp

示例3: OnHit

void ABounceBlock::OnHit(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	//衝突された場合の判定
	UE_LOG(LogTemp, Log, TEXT("On Hit Call!"));

	//横方向に限定して弾き返す
	float speed = NormalImpulse.Size();
	NormalImpulse.Z = 0;

	//ベロシティを反射方向に導く
	FVector velocity = OtherComp->GetComponentVelocity();
	float power = velocity.Size();
	if (power > 0.0f){
		NormalImpulse.Normalize();
		NormalImpulse = velocity + 2 * (-velocity | NormalImpulse) * NormalImpulse;

		power = NormalImpulse.Size();
		NormalImpulse.Z = 0;
		NormalImpulse.Normalize();

		NormalImpulse *= power;

		OtherComp->SetPhysicsLinearVelocity(NormalImpulse);
	}

	//トルクを0にしてみる
	OtherComp->SetPhysicsAngularVelocity(FVector(0, 0, 0));

	//弾き返す!!
	//OtherComp->AddImpulseAtLocation(NormalImpulse * 2.0f, Hit.Location);

}
开发者ID:ishikawa8841,项目名称:MazeOfGame,代码行数:32,代码来源:BounceBlock.cpp

示例4: Injury_Implementation

void AFlySkillActor::Injury_Implementation()
{
	AAONGameState* ags = Cast<AAONGameState>(UGameplayStatics::GetGameState(GetWorld()));
	for (AHeroCharacter* hero : AttackCollision)
	{
		// 如果不同隊才造成傷害
		if (hero && hero->TeamId != this->TeamId)
		{
			// 物傷
			if (PhysicalDamage > 0)
			{
				float Injury = ags->ArmorConvertToInjuryPersent(hero->CurrentArmor);
				float Damage = PhysicalDamage * Injury;
				hero->CurrentHP -= Damage;

				// 顯示傷害文字
				ADamageEffect* TempDamageText = GetWorld()->SpawnActor<ADamageEffect>(AHeroCharacter::ShowDamageEffect);
				if (TempDamageText)
				{
					FVector pos = hero->GetActorLocation();
					pos.X += 10;
					TempDamageText->OriginPosition = pos;
					TempDamageText->SetString(FString::FromInt((int32)Damage));
					FVector scaleSize(TempDamageText->ScaleSize, TempDamageText->ScaleSize, TempDamageText->ScaleSize);
					TempDamageText->SetActorScale3D(scaleSize);
					FVector dir = hero->GetActorLocation() - GetActorLocation();
					dir.Normalize();
					TempDamageText->FlyDirection = dir;
				}
			}
			// 法傷
			if (MagicDamage > 0)
			{
				float Damage = MagicDamage * (1 - hero->CurrentMagicInjured);
				hero->CurrentHP -= Damage;

				// 顯示傷害文字
				ADamageEffect* TempDamageText = GetWorld()->SpawnActor<ADamageEffect>(AHeroCharacter::ShowDamageEffect);
				if (TempDamageText)
				{
					FVector pos = hero->GetActorLocation();
					pos.X += 10;
					TempDamageText->OriginPosition = pos;
					TempDamageText->SetString(FString::FromInt((int32)Damage));
					FVector scaleSize(TempDamageText->ScaleSize, TempDamageText->ScaleSize, TempDamageText->ScaleSize);
					TempDamageText->SetActorScale3D(scaleSize);
					FVector dir = hero->GetActorLocation() - GetActorLocation();
					dir.Normalize();
					TempDamageText->FlyDirection = dir;
				}
			}
			hero->BuffQueue.Append(Buffs);
		}
	}
	AttackCollision.Empty();
}
开发者ID:damody,项目名称:AmbitionOfNobunaga,代码行数:56,代码来源:FlySkillActor.cpp

示例5: MakeRotationFromAxes

FRotator UKismetMathLibrary::MakeRotationFromAxes(FVector Forward, FVector Right, FVector Up)
{
	Forward.Normalize();
	Right.Normalize();
	Up.Normalize();

	FMatrix RotMatrix(Forward, Right, Up, FVector::ZeroVector);

	return RotMatrix.Rotator();
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:10,代码来源:KismetMathLibrary.cpp

示例6: CalcVectors

/** Utility for calculating drag direction when you click on this widget. */
void HWidgetUtilProxy::CalcVectors(FSceneView* SceneView, const FViewportClick& Click, FVector& LocalManDir, FVector& WorldManDir, float& DragDirX, float& DragDirY)
{
	if(Axis == EAxisList::X)
	{
		WorldManDir = WidgetMatrix.GetScaledAxis( EAxis::X );
		LocalManDir = FVector(1,0,0);
	}
	else if(Axis == EAxisList::Y)
	{
		WorldManDir = WidgetMatrix.GetScaledAxis( EAxis::Y );
		LocalManDir = FVector(0,1,0);
	}
	else
	{
		WorldManDir = WidgetMatrix.GetScaledAxis( EAxis::Z );
		LocalManDir = FVector(0,0,1);
	}

	FVector WorldDragDir = WorldManDir;

	if(Mode == WMM_Rotate)
	{
		if( FMath::Abs(Click.GetDirection() | WorldManDir) > KINDA_SMALL_NUMBER ) // If click direction and circle plane are parallel.. can't resolve.
		{
			// First, find actual position we clicking on the circle in world space.
			const FVector ClickPosition = FMath::LinePlaneIntersection(	Click.GetOrigin(),
																	Click.GetOrigin() + Click.GetDirection(),
																	WidgetMatrix.GetOrigin(),
																	WorldManDir );

			// Then find Radial direction vector (from center to widget to clicked position).
			FVector RadialDir = ( ClickPosition - WidgetMatrix.GetOrigin() );
			RadialDir.Normalize();

			// Then tangent in plane is just the cross product. Should always be unit length again because RadialDir and WorlManDir should be orthogonal.
			WorldDragDir = RadialDir ^ WorldManDir;
		}
	}

	// Transform world-space drag dir to screen space.
	FVector ScreenDir = SceneView->ViewMatrices.ViewMatrix.TransformVector(WorldDragDir);
	ScreenDir.Z = 0.0f;

	if( ScreenDir.IsZero() )
	{
		DragDirX = 0.0f;
		DragDirY = 0.0f;
	}
	else
	{
		ScreenDir.Normalize();
		DragDirX = ScreenDir.X;
		DragDirY = ScreenDir.Y;
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:56,代码来源:Utils.cpp

示例7: Tick

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

	//Rotate our actor's yaw, which will turn our camera because we're attached to it
	{
		FRotator NewRotation = OurCameraBase->GetComponentRotation();
		NewRotation.Yaw += -CameraInput.X;
		OurCameraBase->SetWorldRotation(NewRotation);
	}

	//Rotate our camera's pitch, but limit it so we're always looking downward
	{
		FRotator NewRotation = OurCameraBase->GetComponentRotation();
		NewRotation.Pitch = FMath::Clamp(NewRotation.Pitch - CameraInput.Y, -80.0f, 80.0f);
		OurCameraBase->SetWorldRotation(NewRotation);
	}

	//Handle movement based on our "MoveX" and "MoveY" axes
	{
		if (!MovementInput.IsZero())
		{
			//Scale our movement input axis values by 100 units per second
			MovementInput = MovementInput.SafeNormal() * 100.0f;
			FVector NewLocation = GetActorLocation();
			NewLocation += GetActorForwardVector() * MovementInput.X * DeltaTime;
			NewLocation += GetActorRightVector() * MovementInput.Y * DeltaTime;
			SetActorLocation(NewLocation);
		}
	}




	FVector LeftEyePosition = LeftEyePos->GetComponentLocation() - OurCamera->GetComponentLocation();
	LeftEyePosition.Normalize();

	FVector RightEyePosition = RightEyePos->GetComponentLocation() - OurCamera->GetComponentLocation();
	RightEyePosition.Normalize();

	FVector4 LeftEyeWeight;
	FVector4 RightEyeWeight;

	for (int i = 0; i < 4; i++)
	{
		LeftEyeWeight[i] = FVector::DotProduct((LeftEyePosition - FishEyePos[i]), dir[i]) / length[i];
		RightEyeWeight[i] = FVector::DotProduct((RightEyePosition - FishEyePos[i]), dir[i]) / length[i];
	}

	RV_MatInst->SetVectorParameterValue(FName("LeftEyePos"), LeftEyePosition);
	RV_MatInst->SetVectorParameterValue(FName("RightEyePos"), RightEyePosition);
	RV_MatInst->SetVectorParameterValue(FName("RightWeight"), LeftEyePosition);
	RV_MatInst->SetVectorParameterValue(FName("LeftWeight"), RightEyePosition);
}
开发者ID:CharlieLwc,项目名称:Panorama3D,代码行数:55,代码来源:PawnWithCamera.cpp

示例8: GetAngularVelocityToAlignAxis

FVector UFlareSpacecraftNavigationSystem::GetAngularVelocityToAlignAxis(FVector LocalShipAxis, FVector TargetAxis, FVector TargetAngularVelocity, float DeltaSeconds) const
{
	TArray<UActorComponent*> Engines = Spacecraft->GetComponentsByClass(UFlareEngine::StaticClass());

	FVector AngularVelocity = Spacecraft->Airframe->GetPhysicsAngularVelocity();
	FVector WorldShipAxis = Spacecraft->Airframe->GetComponentToWorld().GetRotation().RotateVector(LocalShipAxis);

	WorldShipAxis.Normalize();
	TargetAxis.Normalize();

	FVector RotationDirection = FVector::CrossProduct(WorldShipAxis, TargetAxis);
	RotationDirection.Normalize();
	float Dot = FVector::DotProduct(WorldShipAxis, TargetAxis);
	float angle = FMath::RadiansToDegrees(FMath::Acos(Dot));

	FVector DeltaVelocity = TargetAngularVelocity - AngularVelocity;
	FVector DeltaVelocityAxis = DeltaVelocity;
	DeltaVelocityAxis.Normalize();

	float TimeToFinalVelocity;

	if (FMath::IsNearlyZero(DeltaVelocity.SizeSquared()))
	{
		TimeToFinalVelocity = 0;
	}
	else {
		FVector SimpleAcceleration = DeltaVelocityAxis * GetAngularAccelerationRate();
		// Scale with damages
		float DamageRatio = GetTotalMaxTorqueInAxis(Engines, DeltaVelocityAxis, true) / GetTotalMaxTorqueInAxis(Engines, DeltaVelocityAxis, false);
		FVector DamagedSimpleAcceleration = SimpleAcceleration * DamageRatio;

		FVector Acceleration = DamagedSimpleAcceleration;
		float AccelerationInAngleAxis =  FMath::Abs(FVector::DotProduct(DamagedSimpleAcceleration, RotationDirection));

		TimeToFinalVelocity = (DeltaVelocity.Size() / AccelerationInAngleAxis);
	}

	float AngleToStop = (DeltaVelocity.Size() / 2) * (FMath::Max(TimeToFinalVelocity,DeltaSeconds));

	FVector RelativeResultSpeed;

	if (AngleToStop > angle) {
		RelativeResultSpeed = TargetAngularVelocity;
	}
	else
	{
		float MaxPreciseSpeed = FMath::Min((angle - AngleToStop) / (DeltaSeconds * 0.75f), GetAngularMaxVelocity());

		RelativeResultSpeed = RotationDirection;
		RelativeResultSpeed *= MaxPreciseSpeed;
	}

	return RelativeResultSpeed;
}
开发者ID:Helical-Games,项目名称:HeliumRain,代码行数:54,代码来源:FlareSpacecraftNavigationSystem.cpp

示例9: HandleMovementAbs

void ACinemotusPlayerController::HandleMovementAbs(float DeltaTime, bool useHydraMotion = false)
{
	APawn* pawn = GetPawn();
	if (!pawn)
	{
		return;
	}

	

	//check velocities
	FVector velocity = useHydraMotion ? HydraLatestData->controllers[CAM_HAND].velocity : FVector::ZeroVector;
	FVector velRel = FVector(velocity);
	FRotationMatrix mat(GetControlRotation());
	float scalar = 2.5;
	if (useHydraMotion)
	{
		FRotationMatrix cMat(HydraLatestData->controllers[CAM_HAND].rotation);
		velRel.X = FVector::DotProduct(cMat.GetScaledAxis(EAxis::X), velocity);
		velRel.Y = FVector::DotProduct(cMat.GetScaledAxis(EAxis::Y), velocity);
		velRel.Z = FVector::DotProduct(cMat.GetScaledAxis(EAxis::Z), velocity); //take motion and make relative to the orientation of the controller
	}
	//velocity.X*DeltaTime * scaleCmToMetres*fSpeedMulitplier +

	pawn->AddMovementInput(mat.GetScaledAxis(EAxis::X), velRel.X*DeltaTime * scalar*fSpeedMulitplier + vXYandCrane.X);
	pawn->AddMovementInput(mat.GetScaledAxis(EAxis::Y), velRel.Y*DeltaTime * scalar*fSpeedMulitplier + vXYandCrane.Y);
	pawn->AddMovementInput(mat.GetScaledAxis(EAxis::Z), velRel.Z*DeltaTime * scalar*fSpeedMulitplier);
	pawn->AddMovementInput(FVector::UpVector, vXYandCrane.Z);


	//Add Movement input for offhand

	FVector xPlanar = mat.GetScaledAxis(EAxis::X);
	xPlanar.Z = 0;
	bool didNorm = xPlanar.Normalize();
	if (!didNorm)
	{ 
		xPlanar.X = 1.0; xPlanar.Normalize(); }
	pawn->AddMovementInput(xPlanar, offHandPlanarMovement.X);


	FVector yPlanar = mat.GetScaledAxis(EAxis::Y);
	yPlanar.Z = 0;
	didNorm = yPlanar.Normalize();
	if (!didNorm) { yPlanar.Y = 1.0; yPlanar.Normalize(); }
	pawn->AddMovementInput(yPlanar, offHandPlanarMovement.Y);



}
开发者ID:erinmichno,项目名称:CinemotusUE4,代码行数:50,代码来源:CinemotusPlayerController.cpp

示例10: Instant_Fire

void ABaseWeapon::Instant_Fire()
{
	const int32 RandomSeed = FMath::Rand();
	FRandomStream WeaponRandomStream(RandomSeed);
	const float CurrentSpread = WeaponConfig.WeaponSpread;
	const float SpreadCone = FMath::DegreesToRadians(WeaponConfig.WeaponSpread * 0.5);
	const FVector AimDir = MyPawn->GetActorForwardVector();
	const FVector StartTrace = MyPawn->GetActorLocation();
	const FVector ShootDir = WeaponRandomStream.VRandCone(AimDir, SpreadCone, SpreadCone);
	FVector EndTrace;

	if (Target)
	{
		FVector TargetDir = (MyPawn->GetActorLocation() - Target->GetActorLocation());
		TargetDir.Normalize();
		FVector ShootDir2 = WeaponRandomStream.VRandCone(-TargetDir, SpreadCone, SpreadCone);
		EndTrace = StartTrace + ShootDir2 * WeaponConfig.WeaponRange;
	}
	else
	{
		EndTrace = StartTrace + ShootDir * WeaponConfig.WeaponRange;
	}

	const FHitResult Impact = WeaponTrace(StartTrace, EndTrace);
	SpawnParticle(EndTrace);
	HitActor = Cast<AActor>(Impact.GetActor());

	//DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor::Red, false, 1.0f);

	if (HitActor)
	{
		Server_DealDamage(Impact, ShootDir, WeaponConfig);
	}
}
开发者ID:ZerosGames,项目名称:FightKillWin,代码行数:34,代码来源:BaseWeapon.cpp

示例11: Draw

void UAnimGraphNode_BoneDrivenController::Draw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent* SkelMeshComp) const
{	
	static const float ArrowHeadWidth = 5.0f;
	static const float ArrowHeadHeight = 8.0f;

	int32 SourceIdx = SkelMeshComp->GetBoneIndex(Node.SourceBone.BoneName);
	int32 TargetIdx = SkelMeshComp->GetBoneIndex(Node.TargetBone.BoneName);

	if(SourceIdx != INDEX_NONE && TargetIdx != INDEX_NONE)
	{
		FTransform SourceTM = SkelMeshComp->GetSpaceBases()[SourceIdx] * SkelMeshComp->ComponentToWorld;
		FTransform TargetTM = SkelMeshComp->GetSpaceBases()[TargetIdx] * SkelMeshComp->ComponentToWorld;

		PDI->DrawLine(TargetTM.GetLocation(), SourceTM.GetLocation(), FLinearColor(0.0f, 0.0f, 1.0f), SDPG_Foreground, 0.5f);

		FVector ToTarget = TargetTM.GetTranslation() - SourceTM.GetTranslation();
		FVector UnitToTarget = ToTarget;
		UnitToTarget.Normalize();
		FVector Midpoint = SourceTM.GetTranslation() + 0.5f * ToTarget + 0.5f * UnitToTarget * ArrowHeadHeight;

		FVector YAxis;
		FVector ZAxis;
		UnitToTarget.FindBestAxisVectors(YAxis, ZAxis);
		FMatrix ArrowMatrix(UnitToTarget, YAxis, ZAxis, Midpoint);

		DrawConnectedArrow(PDI, ArrowMatrix, FLinearColor(0.0f, 1.0f, 0.0), ArrowHeadHeight, ArrowHeadWidth, SDPG_Foreground);

		PDI->DrawPoint(SourceTM.GetTranslation(), FLinearColor(0.8f, 0.8f, 0.2f), 5.0f, SDPG_Foreground);
		PDI->DrawPoint(SourceTM.GetTranslation() + ToTarget, FLinearColor(0.8f, 0.8f, 0.2f), 5.0f, SDPG_Foreground);
	}
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:31,代码来源:AnimGraphNode_BoneDrivenController.cpp

示例12: Tick

void ASpellForceField::Tick( float DeltaSeconds )
{
	// push everything inside the sphere radially
	Super::Tick( DeltaSeconds );

	// search the proxbox for all actors in the volume.
	TArray<AActor*> actors;
	ProxSphere->GetOverlappingActors( actors );

	// damage each actor the sphere overlaps
	for( int c = 0; c < actors.Num(); c++ )
	{
		// don't damage the spell caster
		if( actors[ c ] != Caster )
		{
			// Only apply the damage if the box is overlapping the actors ROOT component.
			// This way damage doesn't get applied for simply overlapping the SightSphere.
			AMonster *monster = Cast<AMonster>( actors[c] );
			
			if( monster && ProxSphere->IsOverlappingComponent( monster->GetCapsuleComponent() ) )
			{
				FVector toMonster = monster->GetActorLocation() - GetActorLocation();
				toMonster.Normalize();
				monster->Knockback += toMonster*500;
			}
		}
	}
	
	TimeAlive += DeltaSeconds;
	if( TimeAlive > Duration )
	{
		Destroy();
	}
}
开发者ID:phillzz,项目名称:GoldenEgg,代码行数:34,代码来源:SpellForceField.cpp

示例13: GetTotalMaxThrustInAxis

FVector UFlareSpacecraftNavigationSystem::GetTotalMaxThrustInAxis(TArray<UActorComponent*>& Engines, FVector Axis, bool WithOrbitalEngines) const
{
	Axis.Normalize();
	FVector TotalMaxThrust = FVector::ZeroVector;
	for (int32 i = 0; i < Engines.Num(); i++)
	{
		UFlareEngine* Engine = Cast<UFlareEngine>(Engines[i]);

		FVector WorldThrustAxis = Engine->GetThrustAxis();
		float Ratio = FVector::DotProduct(WorldThrustAxis, Axis);

		if (Engine->IsA(UFlareOrbitalEngine::StaticClass()))
		{
			if(WithOrbitalEngines && Ratio + 0.2 > 0)
			{
				TotalMaxThrust += WorldThrustAxis * Engine->GetMaxThrust() * (Ratio + 0.2);
			}
		}
		else
		{
			if (Ratio > 0)
			{
				TotalMaxThrust += WorldThrustAxis * Engine->GetMaxThrust() * Ratio;
			}
		}
	}

	return TotalMaxThrust;
}
开发者ID:Helical-Games,项目名称:HeliumRain,代码行数:29,代码来源:FlareSpacecraftNavigationSystem.cpp

示例14: InitSkeleton

void SAnimationSegmentViewport::InitSkeleton()
{
	UObject *Object = NULL;
	AnimRefPropertyHandle->GetValue(Object);
	UAnimSequenceBase *AnimSequence = Cast<UAnimSequenceBase>(Object);
	USkeleton *Skeleton = NULL;
	if(AnimSequence != NULL)
	{
		Skeleton = AnimSequence->GetSkeleton();
	}

	if( PreviewComponent != NULL && Skeleton != NULL )
	{
		USkeletalMesh* PreviewMesh = Skeleton->GetAssetPreviewMesh(AnimSequence);
		if (PreviewMesh)
		{
			UAnimSingleNodeInstance * Preview = PreviewComponent->PreviewInstance;
			if((Preview == NULL || Preview->GetCurrentAsset() != AnimSequence) ||
				(PreviewComponent->SkeletalMesh != PreviewMesh))
			{
				PreviewComponent->SetSkeletalMesh(PreviewMesh);
				PreviewComponent->EnablePreview(true, AnimSequence, NULL);
				PreviewComponent->PreviewInstance->SetLooping(true);

				//Place the camera at a good viewer position
				FVector NewPosition = LevelViewportClient->GetViewLocation();
				NewPosition.Normalize();
				LevelViewportClient->SetViewLocation(NewPosition * (PreviewMesh->GetImportedBounds().SphereRadius*1.5f));
			}
		}
	}

	TargetSkeleton = Skeleton;
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:34,代码来源:AnimMontageSegmentDetails.cpp

示例15:

	/** Initialization constructor. */
	FDirectionalLightSceneProxy(const UDirectionalLightComponent* Component):
		FLightSceneProxy(Component),
		bEnableLightShaftOcclusion(Component->bEnableLightShaftOcclusion),
		OcclusionMaskDarkness(Component->OcclusionMaskDarkness),
		OcclusionDepthRange(Component->OcclusionDepthRange),
		LightShaftOverrideDirection(Component->LightShaftOverrideDirection),
		DynamicShadowCascades(Component->DynamicShadowCascades),
		CascadeDistributionExponent(Component->CascadeDistributionExponent),
		CascadeTransitionFraction(Component->CascadeTransitionFraction),
		ShadowDistanceFadeoutFraction(Component->ShadowDistanceFadeoutFraction),
		bUseInsetShadowsForMovableObjects(Component->bUseInsetShadowsForMovableObjects),
		DistanceFieldShadowDistance(Component->bUseRayTracedDistanceFieldShadows ? Component->DistanceFieldShadowDistance : 0),
		LightSourceAngle(Component->LightSourceAngle)
	{
		LightShaftOverrideDirection.Normalize();

		if(Component->Mobility == EComponentMobility::Movable)
		{
			WholeSceneDynamicShadowRadius = Component->DynamicShadowDistanceMovableLight;
		}
		else
		{
			WholeSceneDynamicShadowRadius = Component->DynamicShadowDistanceStationaryLight;
		}
	}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:26,代码来源:DirectionalLightComponent.cpp


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