Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Connect dynamic rope attachment to another rigidbody object
#1
Pregunta 
I am trying to make a first person grappling hook mechanic using obi rope. The rope is attached dynamically to an object which is the fire source, which is the child of the camera which I placed inside of the player object (which has a rigidbody). On the other end it is statically attached.
Right now I managed to make it work almost as it should: I added a fixed joint to the fire source, which links it to the camera; the camera also has a fixed joint which links it to the player.
The grappling itself is working, the issue is that jumping and ground movement now feel very clunky because of the player object's two childs (camera and fire source) which now have rigidbodies... How can I improve this? Or are there better ways of doing this overall?

Here's a link to a google drive folder with some screenshots and a video: https://drive.google.com/drive/folders/1...sp=sharing
Reply
#2
Update: I connected the rope directly to the player, and thus now behaves correctly. The only issue is that as I move the camera up and down, the rope's start point remains at a fixed height, not moving up and down with the gun.
Reply
#3
(21-12-2021, 02:50 PM)ghawstie Wrote: Update: I connected the rope directly to the player, and thus now behaves correctly. The only issue is that as I move the camera up and down, the rope's start point remains at a fixed height, not moving up and down with the gun.

As long as your character has a rigidbody component, you can attach the rope to any other collider below its hierarchy. There's no need to attach the rope directly to the player, or to have a second rigidbody at the fire source. I'd try attaching the rope to your gun, then placing a single rigidbody component in your character's gameObject.

This should work because the rigidbody "used" by any collider in Unity is the first rigidbody found up its hierarchy.

Let me know if you need further help! Sonrisa
Reply
#4
(21-12-2021, 03:04 PM)josemendez Wrote: As long as your character has a rigidbody component, you can attach the rope to any other collider below its hierarchy. There's no need to attach the rope directly to the player, or to have a second rigidbody at the fire source. I'd try attaching the rope to your gun, then placing a single rigidbody component in your character's gameObject.

This should work because the rigidbody "used" by any collider in Unity is the first rigidbody found up its hierarchy.

Let me know if you need further help! Sonrisa

Oh wow it works. xd I can't believe the solution was that simple all along... Thanks!

I was using multiple rigidbodies because I was trying to use joints to link objects, but apparently there is no need for that. xd
Reply