Impact Decals

Hi all,

Apart from spawning particle FX when we hit an actor/wall/whatever, I wanted to take out some time to have a decal appear when it hit the same object, everything was working fine with this until a couple of days ago, until an update occurred. I was too busy with the “behaviour trees” to notice. Anyway, today nothing was appearing when I hit the shoot button, so, I re-imported the graphic that made the decal and redid the material and it works some of the time!?!

Shooting most walls makes a rectangular block appear on the wall,ie not not my decal, whereas, the remaining walls have the decal appearing correctly like a bullet hole. The code is have is:

	FVector decalSize;
			decalSize.X = 15.0f;	
			decalSize.Y = 15.0f;
			decalSize.Z = 15.0f;
	FRotator decalRot{0,0,0};

//little decal where the bullet actually hits - coolio!!!
		UGameplayStatics::SpawnDecalAtLocation(GetWorld(), bulletHole, decalSize, fHit.Location, decalRot, 20.0f);

Would anyone here be able to tell what is going on here and what I might be able to do to solve the problem?

Thankyou and Regards.

Would you mind showing screenshots as to what it looks like?

Hello Dan,

I just took a screenshot showing the 2 results of the decals - I made them larger than they should be so they could be seen properly. I was further surprised by the fact that the normal decals are having some weird results as well. For instance, you will see that the decal is appearing behind the line and in some cases the text in other places?!?

Screenshot:

The gun shots were taken from the same spot in the same game. If you need more screenshots then ask and I’ll get them on here pronto!

Thankyou and Regards.

That is controlled by the sort order on the decal.

image

As for the wall is it that specific wall or all uses of that static mesh?

I have found out that any mesh that has some form of colour on it, be it a line or a word makes the decal go rectangular including the roof/floor. But there are a couple of recurring meshes named “A6” and “Win_Divider_B” where no decal appears at all. The remaining meshes show the bullet decal properly.

I thought the sort order might be the solution, but, I can’t find that option anywhere. Maybe I have made the decal all wrong!?!

The only other thing I can possibly think of is the Rotation of the decal, but, I just can’t figure out how I could possibly correct that.

To test to see if that’s the issue, have you tried rotating it manually during play?

I wasn’t sure what you meant to manually rotate during play. So I went through the changing the values, building, then playing and I found that changing the Roll value (???) to 90 allowed most of the previous rectangular decals (roof and floor exceptions) to appear correctly but then the other places that were displaying proper decals were now rectangular. So, it’s definitely a rotation problem but I have no idea how to set it programatically to display all of them correctly.

So, do you have any ideas how it might be done? Or, know of a Unreal function that would work?

Thankyou for your patience!!!

Having another look at your code I didn’t notice you were using a rotation of 0. You should use the normal of the hit i.e. Hit.Normal.Rotation()

Oh, please don’t tell me it’s that easy to fix!!!

I’ll try that first thing tomorrow morning and get back to you!

Success!!! On all the walls/floor/roof where the decal can be shown it appears correctly. There are a couple of standouts where it doesn’t appear, but, this is good enough for me.

Thanks greatly and regards O Guru :sunglasses:.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms