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


C++ USceneComponent::SetRelativeLocationAndRotation方法代码示例

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


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

示例1:

void FMovieScene3DAttachTrackInstance::UpdateConstraint( float Position, const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, AActor* Actor, UMovieScene3DConstraintSection* ConstraintSection ) 
{
	FVector Translation;
	FRotator Rotation;

	UMovieScene3DAttachSection* AttachSection = CastChecked<UMovieScene3DAttachSection>(ConstraintSection);

	for( int32 ObjIndex = 0; ObjIndex < RuntimeObjects.Num(); ++ObjIndex )
	{
		USceneComponent* SceneComponent = MovieSceneHelpers::SceneComponentFromRuntimeObject(RuntimeObjects[ObjIndex].Get());

		if (SceneComponent != nullptr)
		{
			AttachSection->Eval(SceneComponent, Position, Actor, Translation, Rotation);

			// Set the relative translation and rotation.  Note they are set once instead of individually to avoid a redundant component transform update.
			SceneComponent->SetRelativeLocationAndRotation(Translation, Rotation);
		}
	}
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:20,代码来源:MovieScene3DAttachTrackInstance.cpp

示例2:

void FMovieScene3DTransformTrackInstance::Update( float Position, float LastPosition, const TArray<UObject*>& RuntimeObjects, class IMovieScenePlayer& Player ) 
{
	FVector Translation;
	FRotator Rotation;
	FVector Scale;
	bool bHasTranslationKeys = false;
	bool bHasRotationKeys = false;
	bool bHasScaleKeys = false;

	if( TransformTrack->Eval( Position, LastPosition, Translation, Rotation, Scale, bHasTranslationKeys, bHasRotationKeys, bHasScaleKeys ) )
	{
		for( int32 ObjIndex = 0; ObjIndex < RuntimeObjects.Num(); ++ObjIndex )
		{
			UObject* Object = RuntimeObjects[ObjIndex];

			AActor* Actor = Cast<AActor>( Object );

			USceneComponent* SceneComponent = NULL;
			if( Actor && Actor->GetRootComponent() )
			{
				// If there is an actor, modify its root component
				SceneComponent = Actor->GetRootComponent();
			}
			else
			{
				// No actor was found.  Attempt to get the object as a component in the case that we are editing them directly.
				SceneComponent = Cast<USceneComponent>( Object );
			}

			// Set the relative translation and rotation.  Note they are set once instead of individually to avoid a redundant component transform update.
			SceneComponent->SetRelativeLocationAndRotation(
				bHasTranslationKeys ? Translation : SceneComponent->RelativeLocation,
				bHasRotationKeys ? Rotation : SceneComponent->RelativeRotation );

			if( bHasScaleKeys )
			{
				SceneComponent->SetRelativeScale3D( Scale );
			}
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:41,代码来源:MovieScene3DTransformTrackInstance.cpp

示例3: ApplyLevelTransform

void FLevelUtils::ApplyLevelTransform( ULevel* Level, const FTransform& LevelTransform, bool bDoPostEditMove )
{
	bool bTransformActors =  !LevelTransform.Equals(FTransform::Identity);
	if (bTransformActors)
	{
		if (!LevelTransform.GetRotation().IsIdentity())
		{
			// If there is a rotation applied, then the relative precomputed bounds become invalid.
			Level->bTextureStreamingRotationChanged = true;
		}

		// Iterate over all actors in the level and transform them
		for( int32 ActorIndex=0; ActorIndex<Level->Actors.Num(); ActorIndex++ )
		{
			AActor* Actor = Level->Actors[ActorIndex];

			// Don't want to transform children they should stay relative to there parents.
			if( Actor && Actor->GetAttachParentActor() == NULL )
			{
				// Has to modify root component directly as GetActorPosition is incorrect this early
				USceneComponent *RootComponent = Actor->GetRootComponent();
				if (RootComponent)
				{
					RootComponent->SetRelativeLocationAndRotation( LevelTransform.TransformPosition(RootComponent->RelativeLocation), (FTransform(RootComponent->RelativeRotation) * LevelTransform).Rotator());
				}			
			}
		}

#if WITH_EDITOR
		if( bDoPostEditMove )
		{
			ApplyPostEditMove( Level );						
		}
#endif // WITH_EDITOR

		Level->OnApplyLevelTransform.Broadcast(LevelTransform);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:38,代码来源:LevelUtils.cpp


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