How can i make viewmodel cant clip through wall?

  1. What do you want to achieve?
    How can i make like if my viewmodel clip through wall the my viewmodel goes sideways or backup lil bit like acs/hedgerows/deadline

  2. What is the issue?
    I just can’t.

  3. What solutions have you tried so far?
    Watching yt devforum using cframe nothing works

Can you show me a video of it?

Streamable Video (ignore)—jdsksjendjdjdjd)

You can do this two ways. You can either raycast in the direction of the gun relative to the position of the humanoid and then try and make is so the character can’t step close enough to walls to have the gun clip through them.

The second option is to use a ViewportFrame | Roblox Creator Documentation and have the gun and hands rendered inside of it. This is the prefferable method, but it also comes with drawbacks. If your gun uses pbr textures then they won’t be rendered inside of the viewport. Also, it’s says directly on the documentation page: “At the moment, no shadow or post effects are available. Neon and Glass materials will be rendered on lowest quality,” meaning that model details are relatively limited inside the viewport. The good news is that the code you use for manipulating the arms and gun can remain relatively unchanged depending on how you have set it up.

4 Likes