I've seen a lot of threads here about about creating ropes, but I am trying to see how one would go about attaching a character to the end of the rope in order to climb or swing on it. The end goal I am aiming for is being able to (once the grapple is attached on the hook end) being able to raise/lower myself from that point or swing across a gap.
The rope I made is a string of hingeJoints. I've been experimenting with different forms of parenting/hingeJoints and tried to do a solution where I attach the character on the end as a Joint, but the character doesn't seem to leave the ground; even when I use IsKinematic.
Anyway, I'm hoping there's something I'm missing. How should I go about doing this?
An important thing to mention is that the character "throws" this grapple so it is created link-by-link as it flies out of his hands. Imagine a ninja using a grapple to climb a building. The way I was trying to accomplish this before was by using a joint to connect the player to the last link of rope. Then when the player scrolled down, it would "reel" the last link in, and the player would be jointed to the next link in the line. Unfortunately, it seems the player won't move upwards because of this. The rope just gets stretched out.
Sorry if the question is a little vague, but I'm looking for theories on how one would create this; not even to the psuedo-code level.
Answer by Waz
Aug 12, 2011 at 12:34 AM
I think you will want/need to model a taut rope quite differently to a loose one, otherwise you may find the physics simulation not sufficiently precise. That's a lot more work of course if you want multiple joints. Certainly games like Just Cause 2 have a simple rope model (there, the grapple snaps back as soon as it doesn't have line-of-site, I.e. as soon as it cannot be modelled by a single joint).
The point is, be careful trying to implement something with overly-real models. Game Physics is about the experience being fun, intuitive, and predictable. Complicated physics often works against those ideals.
Are you saying then that you would accomplish this differently? The goals I have for the grapple are this: 1. Able to be thrown from an animation 2. Able to attach to some surfaces to pull yourself up 3. Able to attach to other objects to pull them 4. (most complicated) able to act as a pulley, going around something higher up and attaching to an object across from you so you can pull it upward. Thanks for the advice everyone, keep the idea's coming!
Yes, that last one would require more than the one-joint that the Just Cause 2 style of grapple needs.
Answer by roamcel
Aug 09, 2011 at 11:39 AM
I can only offer you a "who knows if" reply, since your question is missing some vital info, but could help you figure out what's going on.
If I were you, I'd run a simple test:
1- set the rope in an horizontal position, extended from its anchor point, so that gravity would normally influence it to swing
2- run the scene and assure that the rope behaves correctly and that it swings and comes to a rest thanks to gravity
3- in the assumption that point 2 concludes correctly, manually child a cube with a proper rigidbody
4- run again and check if the cube correctly influences the rope swing
5- in the even that something's not right: check WEIGHTS. All rigidbodies have a MASS parameter which is expressed in KILOGRAMS
Basically, you need to be sure that the total weight of the rope, summing up all the individual rigidbodies masses, is inferior (way inferior i might add) to that of the character or object that eventually tries to climb it or swing by it.
Am I able to help with some type of info? Just to clarify: the rope itself acts like it should. It is when I try to put the character on the end as a joint (character won't react), I have made sure to have isKinematic as false
What is your character? It sounds like it is a Rigidbody, not a CharacterController, so are you normally (when not climbing on a rope) moving it by applying forces?
The character is using a CharacterController and also has a Rigidbody. I use the character controller for left-right movement and jumping while I use rigidbody for the collisions and physics.
You've got me there. I've never heard of using both at the same time. I'm surprised it is even possible.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
4 People are following this question.
Hinge Joint? Unconstrained.
Hinge Joints that Don't Limit?
reading forces applied to a rigidbody
Character Joints, twist and swing