How to make an object visible which is blocked by other static mesh object?

I want to show x, y, z arrows, just like unreal engine, to adjust object positions.
I use three arrows to simulate it.

The result is like this:


The problem is that: part of the arrows are blocked by the cube. How to make the arrows visible, no matter they are blocked or not?

I think it is the same problem as: how to make an object show in front of anything?

Hi Zhan,

Just like what UE4 editor, You need to get the Primitive in C++ and call UPrimitiveComponent::SetDepthPriorityGroup(). Normally, all primitives are render in SDPG_World, but all UI or highlight primitive should render in SDPG_Foreground. You can search these key words to see how it works in UE4 editor code.

Jin Yaping

Thank you for your reply, really.
We just tried with the code below. But it’s not working.

I searched the web and found something related to this:

It seems like that SetDepthPriorityGroup does nothing in UE4.

Is there any other way to do this?

void UZM_FunctionLibrary::ShowActorInForeground(AActor *actor)
USceneComponent *scene = actor->GetRootComponent();
if(scene == NULL) {
UE_LOG(LogActor, Error, TEXT(“scene is NULL”));

	UPrimitiveComponent* priComp = Cast<UPrimitiveComponent>(scene);
	if(priComp) {
		UE_LOG(LogActor, Warning, TEXT("priComp is NOT NULL!"));

	} else {
		UE_LOG(LogActor, Error, TEXT("priComp is NULL, cast failed"));

Aha, sad news. It seems UE4 don’t have any official solution about this now. But you can try this ( How can you render 3D objects on the hud that are completely independent from the scene? - Rendering - Epic Developer Community Forums ). That means you need use render target for it and add a postprocess to blend with original scene. Also, you can try 3D widget. It’s experimental but still you can try it. I am not sure if it come to stable in latest UE4.12.5.

Jin Yaping