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


C++ FTransform::NormalizeRotation方法代码示例

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


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

示例1: TLerp

FTransform UKismetMathLibrary::TLerp(const FTransform& A, const FTransform& B, float Alpha)
{
	FTransform Result;
	
	FTransform NA = A;
	FTransform NB = B;
	NA.NormalizeRotation();
	NB.NormalizeRotation();
	Result.Blend(NA, NB, Alpha);
	return Result;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:11,代码来源:KismetMathLibrary.cpp

示例2: TickComponent

void UPhysicsHandleComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	const float Alpha = FMath::Clamp(DeltaTime * InterpolationSpeed, 0.f, 1.f);

	FTransform C = CurrentTransform;
	FTransform T = TargetTransform;
	C.NormalizeRotation();
	T.NormalizeRotation();
	CurrentTransform.Blend(C, T, Alpha);

	UpdateHandleTransform(CurrentTransform);
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:14,代码来源:PhysicsHandleComponent.cpp

示例3: LerpBoneTransforms

void FAnimationRuntime::LerpBoneTransforms(TArray<FTransform> & A, const TArray<FTransform> & B, float Alpha, const TArray<FBoneIndexType> & RequiredBonesArray)
{
	if( Alpha >= (1.f - ZERO_ANIMWEIGHT_THRESH) )
	{
		A = B;
	}
	else if( Alpha > ZERO_ANIMWEIGHT_THRESH )
	{
		FTransform* ATransformData = A.GetData(); 
		const FTransform* BTransformData = B.GetData();
		const ScalarRegister VAlpha(Alpha);
		const ScalarRegister VOneMinusAlpha(1.f - Alpha);

		for (int32 Index=0; Index<RequiredBonesArray.Num(); Index++)
		{
			const int32& BoneIndex = RequiredBonesArray[Index];
			FTransform* TA = ATransformData + BoneIndex;
			const FTransform* TB = BTransformData + BoneIndex;

			*TA *= VOneMinusAlpha;
			TA->AccumulateWithShortestRotation(*TB, VAlpha);
			TA->NormalizeRotation();

// 			TA->BlendWith(*TB, Alpha);
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:27,代码来源:AnimationRuntime.cpp

示例4: turnShip

void AShip::turnShip(float delta){
	if (turnDirection == 0)
		return;

	FRotator rot = FRotator(turnDirection * engines->getTurnSpeed() * delta, 0.f, 0.f);
	FTransform transform = GetTransform();
	transform.ConcatenateRotation(rot.Quaternion());
	transform.NormalizeRotation();
	SetActorTransform(transform);

}
开发者ID:Zecknaal,项目名称:Jettisoned,代码行数:11,代码来源:Ship.cpp

示例5: UpdateWorldBoneTransformTable

void UAnimCompress_RemoveLinearKeys::UpdateWorldBoneTransformTable(
	UAnimSequence* AnimSeq, 
	const TArray<FBoneData>& BoneData, 
	const TArray<FTransform>& RefPose,
	int32 BoneIndex, // this bone index should be of skeleton, not mesh
	bool UseRaw,
	TArray<FTransform>& OutputWorldBones)
{
	const FBoneData& Bone		= BoneData[BoneIndex];
	const int32 NumFrames			= AnimSeq->NumFrames;
	const float SequenceLength	= AnimSeq->SequenceLength;
	const int32 FrameStart		= (BoneIndex*NumFrames);
	const int32 TrackIndex = AnimSeq->GetSkeleton()->GetAnimationTrackIndex(BoneIndex, AnimSeq);
	
	check(OutputWorldBones.Num() >= (FrameStart+NumFrames));

	const float TimePerFrame = SequenceLength / (float)(NumFrames-1);

	if( TrackIndex != INDEX_NONE )
	{
		// get the local-space bone transforms using the animation solver
		for ( int32 FrameIndex = 0; FrameIndex < NumFrames; ++FrameIndex )
		{
			float Time = (float)FrameIndex * TimePerFrame;
			FTransform LocalAtom;

			AnimSeq->GetBoneTransform(LocalAtom, TrackIndex, Time, UseRaw);

			FQuat Rot = LocalAtom.GetRotation();
			LocalAtom.SetRotation(EnforceShortestArc(FQuat::Identity, Rot));
			// Saw some crashes happening with it, so normalize here. 
			LocalAtom.NormalizeRotation();

			OutputWorldBones[(BoneIndex*NumFrames) + FrameIndex] = LocalAtom;
		}
	}
	else
	{
		// get the default rotation and translation from the reference skeleton
		FTransform DefaultTransform;
		FTransform LocalAtom = RefPose[BoneIndex];
		LocalAtom.SetRotation(EnforceShortestArc(FQuat::Identity, LocalAtom.GetRotation()));
		DefaultTransform = LocalAtom;

		// copy the default transformation into the world bone table
		for ( int32 FrameIndex = 0; FrameIndex < NumFrames; ++FrameIndex )
		{
			OutputWorldBones[(BoneIndex*NumFrames) + FrameIndex] = DefaultTransform;
		}
	}

	// apply parent transforms to bake into world space. We assume the parent transforms were previously set using this function
	const int32 ParentIndex = Bone.GetParent();
	if (ParentIndex != INDEX_NONE)
	{
		check (ParentIndex < BoneIndex);
		for ( int32 FrameIndex = 0; FrameIndex < NumFrames; ++FrameIndex )
		{
			OutputWorldBones[(BoneIndex*NumFrames) + FrameIndex] = OutputWorldBones[(BoneIndex*NumFrames) + FrameIndex] * OutputWorldBones[(ParentIndex*NumFrames) + FrameIndex];
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:62,代码来源:AnimCompress_RemoveLinearKeys.cpp


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