void AEyeXSimpleInteractorPawn::BeginPlay()
{
	Super::BeginPlay();
	MyRegion = new ActivatableRegion(IEyeXEyetracking::Get().GetNextUniqueRegionId(), RECT());
	IEyeXEyetracking::Get().AddActivatableRegion(*MyRegion);
	IEyeXEyetracking::Get().OnFocusedRegionChanged().AddUObject(this, &AEyeXSimpleInteractorPawn::FocusedObjectChanged);

	BaseScale = GetActorScale();
	FocusedScale = BaseScale * 2;
}
Пример #2
0
void ABrainNormalInteractiveObject::Save(FBrainSaveData& saveData)
{
	FBrainNIOSaveData dataToSave;

	dataToSave._loadFromfile = true;
	dataToSave._location = GetActorLocation();
	dataToSave._rotation = GetActorRotation();
	dataToSave._scale = GetActorScale();
	dataToSave._shearFirstAxis = _currentShearFirstAxis;
	dataToSave._shearSecondAxis = _currentShearSecondAxis;

	saveData.AddDataToSave(GetName(),dataToSave);
}
void AFloatingText::Update( const FVector OrientateToward )
{
	// Orientate it toward the viewer
	const FVector DirectionToward = ( OrientateToward - GetActorLocation() ).GetSafeNormal();

	const FQuat TowardRotation = DirectionToward.ToOrientationQuat();

	// @todo vreditor tweak
	const float LineRadius = 0.1f;
	const float FirstLineLength = 4.0f;	   // Default line length (note that socket scale can affect this!)
	const float SecondLineLength = TextComponent->GetTextLocalSize().Y;	// The second line "underlines" the text


	// NOTE: The origin of the actor will be the designated target of the text
	const FVector FirstLineLocation = FVector::ZeroVector;
	const FQuat FirstLineRotation = FVector::ForwardVector.ToOrientationQuat();
	const FVector FirstLineScale = FVector( FirstLineLength, LineRadius, LineRadius );
	FirstLineComponent->SetRelativeLocation( FirstLineLocation );
	FirstLineComponent->SetRelativeRotation( FirstLineRotation );
	FirstLineComponent->SetRelativeScale3D( FirstLineScale );

	// NOTE: The joint sphere draws at the connection point between the lines
	const FVector JointLocation = FirstLineLocation + FirstLineRotation * FVector::ForwardVector * FirstLineLength;
	const FVector JointScale = FVector( LineRadius );
	JointSphereComponent->SetRelativeLocation( JointLocation );
	JointSphereComponent->SetRelativeScale3D( JointScale );

	// NOTE: The second line starts at the joint location
	SecondLineComponent->SetWorldLocation( JointSphereComponent->GetComponentLocation() );
	SecondLineComponent->SetWorldRotation( ( TowardRotation * -FVector::RightVector ).ToOrientationQuat() );
	SecondLineComponent->SetRelativeScale3D( FVector( ( SecondLineLength / GetActorScale().X ) * GetWorld()->GetWorldSettings()->WorldToMeters / 100.0f, LineRadius, LineRadius ) );

	TextComponent->SetWorldLocation( JointSphereComponent->GetComponentLocation() );
	TextComponent->SetWorldRotation( ( TowardRotation * FVector::ForwardVector ).ToOrientationQuat() );

}