alirezaft / UnityVerletRope

Implementation of rope physics in Unity using Verlet integration
15 stars 2 forks source link

cargo hook? #2

Closed XeonG closed 1 day ago

XeonG commented 1 week ago

Not really an issue more of a feature request expansion on this project and wondering if you would be able to help, perhaps its not even that complicated..

basically the end node being able to hook onto or latch onto particular defined gameobjects nearby like a magnet, and then the top nodes can also start getting removed thus pulling up the carried picked up object as an option?

Basically like a helicopter cargo hook.. so would need to pull up the object.... any pointers or recommendations of unity assets that might do that better or an example would be great.

alirezaft commented 1 week ago

I think it's pretty easy. You just need to specify a point on the object you want to pull, e.g. using an empty game object, then connect it to the last verlet node of the rope, and update the position of your object. I'm not sure but I think you'll need to run verlet integration on the connected object too in order to have natural physics in the whole system. You will also need to calculate the object's rotation since verlet integration doesn't calculate that. If you are looking for a rope asset to use in production, I recommend this asset It's really good and it supports different physical configurations like knots, and pinning rope ends to a point, etc. This repository was intended as an exercise for me, so I don't really recommend it for production.