x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why my umg sprites are wrongly cut?

I have a umg hud setup for my minimap.

alt text

Map is rendered to Image Mini Map, some sprites above it and Canvas Npc for Npc tokens and their visiblilit triangles. I am placing them dynamically at runtime from C++ code.

And here is the image i got in game

alt text

You can see I have two visibility sector sprites cut from the wrong side. Looks like they are cut before they are rotates. Is there option how I can fix this behaviour?

My code for visiblility sprites creation.

 UTexture2D *FovTexture = Npc->NpcAIComponent->LookHalfSector > 50 ? NpcFov120Material : NpcFov60Material;
 VisibilityImage = NewObject<UImage>();
 VisibilityImage->Brush.SetResourceObject(FovTexture);
 
 NpcPanel->AddChild(VisibilityImage);
 NpcCanvasSlot = Cast<UCanvasPanelSlot>(VisibilityImage->Slot);
 NpcCanvasSlot->SetSize(FVector2D(FovTexture->GetSizeX(), FovTexture->GetSizeY()));
 NpcCanvasSlot->SetAlignment(FVector2D(0.5f, 1.0f));
 NpcCanvasSlot->SetAnchors(FAnchors(0.5f, 0.5f));
 VisibilityImage->SetRenderTransformPivot(FVector2D(0.5f, 1.0f));

And code for their position setup and rotation.

 if (VisibilityImage != nullptr) {
     VisibilityImage->SetVisibility(ESlateVisibility::Visible);
     NpcCanvasSlot = Cast<UCanvasPanelSlot>(VisibilityImage->Slot);
     NpcCanvasSlot->SetPosition(NpcPanelCanvasSize * MinimapDirection);
     VisibilityImage->SetRenderAngle((1 - Angle) * 360.f + Npc->GetActorRotation().Yaw + 90);
     VisibilityImage->Brush.TintColor = FSlateColor(FLinearColor(1, 1, 1, 1 - MinimapDistanceSq));
 }

Don't think there are errors there, but just for the info. they are positioned and rotated correctly I think. It is some bug in sprites cutting logic in umg?

They are also wrongly cut in UMG editor preview.

alt text

Any ideas how I can overcome this? Or place where I should dig in UE source code?

Product Version: UE 4.9
Tags:
more ▼

asked Sep 24 '15 at 10:43 AM in Rendering

avatar image

Yata
554 39 50 69

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I'm experiencing similar issue: ![arrow indicator][1]

This my arrow indicator pointing to enemy airship that's outside player's FOV(you see things like this in most flying games)

From what I understand: Unreal first cuts out image that is outside screen and then rotates it. You can see it perfectly on your last image. I think switching order of this two procedures could fix our problem. @Epic please!

Have You found any workaround for that? [1]: /storage/temp/90305-capture.png

capture.png (28.1 kB)
more ▼

answered May 12 '16 at 10:29 AM

avatar image

greeboCherry
53 2 4 9

avatar image Yata May 12 '16 at 12:53 PM

No, I don't remember, I am not working on that project now. But I think we haven't fixed that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The render transform takes whatever is visible and moves it around. So if you have something cut off due to the positioning it'll look like that no matter where you transform it to.

Try changing the actual location of the object and not it's render transform.

Another way would be to spawn it in a place where it's fully visible and then move it to the desired location on the HUD using the render transforms.

more ▼

answered May 12 '16 at 01:40 PM

avatar image

Seirei
10 4 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question