Grabbing system with Cframe

Hi ! Here is my problem, I created a grab script imitating the way of Superliminal using Bodyposition but want to improve it by using Cframe instead.
So I tried to do this but I now encounter a problem, the object is partly found in the wall, how to solve this? Thank you very much!

Video

2 Likes

You can use a shapecasting sphere around the object

so

position = shapeCastOrigin + direction.Unit * result.Distance

1 Like

Thank you very much, I didn’t know this! Just, what is the difference between spherecast and blockcast, do you think spherecast would be better for a grabbing system?

Edit: Having done some tests, I don’t understand how to use Spherecast for my grab system

I managed to create the spherecast and it follows my object, but I don’t understand how to correct the position.