Imprint of car tires on the sand.

Hello. I make an imprint of tires on the sand. There are several different cars with different tread pattern on tires, so I do everything with decals.

First I track the point of collision of the tire with the surface (line trace by channel), then at this point I leave the decal. (Spawn decal at location).

The problem is that when the car accelerates to high speeds, the distance between the decals gradually increases. This is because of the trace.

Tell me please, can there is a way to solve this problem and make the tire imprint continuous?

The ribbon particle has a built-in solution (Spawn per Unit) if your speed increases. You would replace your decals though.

Another approach I know of is using RenderTargets, but that can get expensive depending on your map size and speed.

In the end, I think you have to code your own solution that involves spawning decals depending on the distance you traveled.

I’m not sure where you are doing the logic for spawning the decals and i don’t know your setup but here is how i would start:

Per Tire:

1.Each tick check if the Tire has moved far enough to care and that it is on the ground (don’t spawn if these conditions are not met)
2.If it has: spawn a decal at the tire. Use the distance between the current and last tire location to decide where to place the decal and how long it should be. If the car traveled a long way, set the decal somewhere between the two locations and set the length of it to stretch across.
3. Clean up old decals based on time/distance away from player.

This approach does not take tire rotation or crazy twists/skids into account but the average user probably wouldn’t notice/care. To get fancier you would need to detect tire yaw and affect the rotation of the decal, perhaps spawning multiple decals along the path each tick with each one interpolating between last and current rotation or by using a spline to decide rotation at any given point. Though as i said, this sounds unnecessary.

Make sure your decal fades a bit at the edges to make blending easier.

An interesting solution. And it looks like it’s what I need. I’ll try and write about the result.

Thanks for the answer. I tried to do so, but I did not succeed.

Hello. Finally I managed to get to the project. I tried to use SpawPerUnit and everything superfluous. But I can not make the part turn with the wheel turning in space. Particles always look at the camera regardless of the screen alignment settings.
Do not tell me how to fix this?