Hello!
I’m quite new in game development and Unreal Engine, and i am trying to develop an endless runner type game, and while changing the floor’s material i figured out most of the materials i try to use vibrate when executing the game.
Here is a link to a GIF where you can see the material issue.
I’m using UE 4.22.3, and i have this issue using materials from “Advanced Village Pack” and “Stylized Desert Environment” (i really haven’t tried other packs), there’s one material i have tried that works fine, but it’s not what i look for.
Here is a screenshot of one of the material’s blueprint that is having the issue.
If you can please give me some advice or telling me what’s wrong, i will apreciate it so much.
Thank you for your time ^^
You have surfaces overlapping each other at the same position, that’s called “z-fighting” (because they are “fighting” to see which one is drawn on top).
I didn’t thought that was the problem, but since you said it I’m pretty sure you’re right.
In my game the floor spawns as you go on, so i’ve placed manually a tile of the floor somewhere i can see it (not on the floor) and it doesn’t do that ‘vibration’ or z-fighting.
I’ve algo reduced the amount of pre-generated tiles, and i can see now that when a tile first spawn it doesn’t overlap with anything, but when the next tile spawns, the previous starts overlapping.
I’m printing the number of tiles spawned and it is correct, i think it is not spawning extra tiles, and i can’t find a solution…
Does anyone have any idea of why it only do this with certain materials?
Although i think it is not spawning extra tiles, here it is the SpawnTile blueprint, just in case anyone see something i’m not seeing.
Thank you.
This is the SpawnTile function. *SpawnPoint *is an ArrowComponent. So what we are doing here is spawn each tile after the last tile spawned.
And here is where i call this function, when the actor overlaps a Box Collision. The BP continues with some points rewarding, increasing speed and then a 5 seconds Delay + Destroy Actor.
Alright, i’ve fixed it!
The error was the spawn location of the tiles, it was spawning right in the center (0,0,0) instead of spawning at the end of the tile (500,0,0), so i fixed it by adding a Transform Location (500,0,0) between Next Spawn Point and SpawnActor Master Tile (first photo of my last comment).
Thank you a lot!