How to implement the melee attack like in Muck?

Hello! I recently watched Dani’s Muck video and noticed he implemented the melee attack in an interesting way. In video 11:22 , he is picking a stone. If you set the speed to 0.25 you will clearly see the pick isn’t really colliding with the stone. It’s more like an animated UI that is on top of everything. How can I realize this effect?

Hi @dongminghui1313

I’d do it by raycasting from the top center of your weapon (pickaxe) into your look direction. If the ray hits something “in range”, make an animated sprite visible at that position and animate it. You can place the sprite either in 3D space or map the hit coordinate back into Screenspace, so 2D.

Hope this helps

I think you’re referring to a Depth Only camera, which basically renders what it sees On top of the main camera. So if you set up a camera like this:

![alt text][1]

It’ll render like an overlay to the main camera (It renders what would usually be the skybox as transparent).

The main way to set up something like muck is to use Culling masks to make the “Arms” camera unable to see anything except your own arms/Tools.

![alt text][2]

Then do the opposite for the main camera, only excluding your arms, and you should get an effect like in the video, since the Arms are being rendered separately and thus cannot be blocked by collisions with objects.

If you want to learn more there’s loads of videos out there on camera stacking:


[1]: https://i.imgur.com/9cEkchE.png
[2]: https://i.imgur.com/J29vvzY.png

Thank you both! @AaronBacon @Klarzahs I think by combining raycast and overlay camera I can achieve what I want!