Render layers, but in-game

(Not sure if this belongs in this forum)

I’m working on a game where the player is able to pick up items and the item is attached to the character. The item needs to remain visible in the character’s FOV and it just mostly floats there.

Kinda like this:

Like you’re holding it, but you don’t see your hands. In this case, the item attached to the character needs to have collision and physics disabled so that it stays logically attached to the character and so that I don’t get weird movement issues.

But when I move near a wall…

the item clips - which is expected, I did turn off collision after all.

I read somewhere that what some games do is to render the attached item in another layer, and that some older games do this mostly in FPSs so that the weapon mesh doesn’t clip through the walls. But when I seach for “render layers ue5,” I end up with render layers for rendering scenes.

Any ideas on how to implement a “render layer” for the box mesh in the above photo?

Yes, I can increase the collision capsule size of the player character, but the character needs to be able to go very close to the wall even while they’re holding the item.

I hope I’m making sense here lol

You’re looking for Custom Depth and Stencil buffers

But that’s for rendering meshes with so that they have different appearances. When the attached mesh clips, the mask only affects the visible part of the mesh.

(My mesh in the sample screenshots already uses the stencil buffer, actually. It’s a bit whiter than it should be)

Is this somewhat the expected result?

yup, basically, that’s what im going for

Did you find any solution?

Something like this might be what you’re looking for?

1 Like

Yeah, that sounds like what I need. Thank you!

1 Like