Painting in game Help

Hi

I am trying to make an app that you can put material on meshes (or paint it)

So users screen will be fixed and not be able to look around. And then he will choose one of the meshes on the screen and click the material pics on the screen to paint to that material.

So I need help most importantly on how to make user to be able to choose mesh in game then set material to that mesh.

I’m also looking for something similar. I have found a couple of ways to do this but none of them are really a solution for what I’m after. But maybe they can help you get on the right path.

One of the ways you can do this is by using a raycast to shoot a ray at a mesh that has a material. Then when hitting the mesh, retrieving the hit UV coordinates using “get UV from collision” node. You will also have to go to the project settings and search for “support uv…” and enable that feature, then restart your editor.
The next step is once you obtained the UV’s from the hit to pass them to your material. You can do this by adding to parameter variables to your material. Then inside your blueprint with the raycast, get a dynamic instance of the material and set the two scalar parameters using the retrieved UV coordinates from your raycast hit.

Problem is, I haven’t been able to get this to work. I have no idea why it doesn’t work as this is normally how it should be used. I’ve debugged the retrieved UV coordinates and they seem reasonably correct when printing them to the screen. However, once passed into the material they don’t seem to work. Can’t figure out why.

Another way to do what you are after is using a render target.

This video will show you exactly how to use a render target to get the result you are looking for. For my problem this method is insane overkill though but for your problem this might be perfect.

Well I am not sure that I need ray. Because my game will be a fix screen. So player will not be able to look around. So giving a ray to where he looks will not help me.

Well I guess I need to make player to be able to choose meshes in game with a click. Then set material. Do you have any ideo how do i make user to be able to choose meshes in game?

Thanks for your help.