Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Pulling object problem
#1
I'm completely new to this asset and I have a problem that I cant seem to find a way to solve it. 

I want to have a hook at the end of the rope and when that hook comes in contact with an object it attaches to that object and when the player pulls on the rope, the object comes wit it. 
My first instinct was just to make the object a child of the hook but that doesn't seem to work, the object either does not move or glitches out. 

Then I tried tying the object's transform to the hooks transform in script, so it moves when the hook moves without needing to parent, but then the problem with that was that the object would then would then go through other objects, completely ignoring the collider at some points, or launching other objects or itself into the stratosphere, and there was also the problem of the movement was not looking natural.  

Is there an obvious way to do this that I am missing? 

Thanks in advance!
Reply
#2
Managed to make a work around. 

Through some testing the problem seems to be the rigidbody component on the object I am trying to attach the hook too. Destroying the rigidbody and making the hook the parent of the object when you want the hook to attach to it seems to work, and when you want to detach it you can just add a new rigidbody component to the object and make the parent of the object null.
Reply
#3
(19-05-2021, 08:05 PM)cruzjunior Wrote: Managed to make a work around. 

Through some testing the problem seems to be the rigidbody component on the object I am trying to attach the hook too. Destroying the rigidbody and making the hook the parent of the object when you want the hook to attach to it seems to work, and when you want to detach it you can just add a new rigidbody component to the object and make the parent of the object null.

Glad you found it Sonrisa. Note that making the object kinematic would work too, no need to remove the entire rigidbody component.
Reply