Hello! Im making an FPS and just wondering how can I push my viewmodel back smoothly and make it come back smoothly when i’m close to a wall?
Raycasting may be helpful for this.
What you could do is cast a ray in all of the relevant directions to check and see if there are any walls nearby. Then if that check comes back to be true you would handle the logic from there.
Without knowing the specifics of your View Model implementation it would be hard to elaborate beyond that.
It’s a simple viewmodel that puts a viewmodel at the cframe of the camera, the problem is that I wouldn’t know how to get it back to the original position without going farther.
If the Raycast doesnt detect any parts nearby you would just move it back to the original CFrame of the camera.