Decals spawn not exactly behind shot enemies.

Hello guys!
I’m developing a top-down shooter and have implemented a feature where shot enemies leave decals on the walls behind them. However, I’m encountering an issue where the decals spawn not exactly behind enemies. It seems that the problem is related to the rotation of the forward vector.

To handle damage, I use Event Hit → Apply Damage. To determine the decal’s placement, I use Line Trace by Channel, projecting the forward vector from the point of bullet collision with the enemy (hit location) to locate a wall for the decal. However, the vector does not consistently shoot in the intended direction — it’s different everytime I shoot enemy. Bullet has no gravity and go forward with constant speed.

This is how “projectile look for” wall behind enemy

This is how character shoot

I have followed several tutorials on YouTube, which work well for first-person shooters. I suspect the issue might be related to the top-down camera perspective, but I’m not sure.
Attached screenshots illustrate the variability in vector deviation, often slightly to the right or left, and consistently downwards, sometimes significantly.

Thanks!

Instead of this

just plug the ‘normal’ in, from the hit. If it’s facing in the wrong direction, just * -1

2 Likes

meshes can have odd normals though too, i’d get the direction from the attacker maybe

2 Likes

Ah, good point.

The just carry the shot on, through the victim and hit the wall?

1 Like

@ClockworkOcean @Auran131 Thank you guys! I tried to plug normal, but vector still goes in wrong directions, although directions has changed. BUT the method with the direction from the shooter has worked for me. Did I make it correctly?

1 Like

That looks alright :slight_smile:

1 Like