Jump to content
  • Advertisement
Sign in to follow this  
boogyman19946

Variable range rope physics.

This topic is 983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Not sure if I'm in the right place to ask this but here goes.

 

I'm having issues beating Unity's joints into submission. I've tried to look for a solution, but I can't come up with a good solution, and I'm trying to avoid implementing my own joints (if I even can).

 

So, my intent here is to have a player swing on a rope. Using a single joint like a distance joint looks and feels really crappy, so I've tried making the rope out of multiple joints like a lot of folks suggest. This actually looks good when it works, but it only works in very particular circumstances. The latest iteration is here:

 

http://kjarosz.github.io/Hookshot/Hookshot

 

(Can't play in Chrome; needs Unity Web Player; controls are regular WASD + space + mouse)

 

When you attach yourself to the floating platform, the bug is immediately obvious. Unity can't seem to calculate the necessary forces correctly and causes the joints to spaz out. 

 

I've switch out the joints for all the other available ones but they all similar issues. Distance/Spring Joint just stretches out like bubble gum. The same issues happen when you shorten the "rope length". Basically I remove the joints and have Unity figure out the fact that the player needs to be lifted up appropriately but the same bug occurs.

 

The build in the link tries to fake it a bit, but the result is really crappy. There is essentially a single distance joint connecting the player and the anchor point and that maintains the player's position under the hood. The visible rope is made out of a multitude of jointed objects that tracks the player's position through a script.

 

Has anyone dealt with this issue? Is there any reasonable way to solve it? At one point I thought about implementing my own joints but I just don't know how much of a viable solution that is. Any ideas?

Edited by boogyman19946

Share this post


Link to post
Share on other sites
Advertisement
This video seems to get it to work using hinge joints


I've never done chains in unity, but I had spastic chains in Chipmunk, a 2D physics engine. It was usually a result of too much force being applied at the end of the chain.

Share this post


Link to post
Share on other sites

That's the issue I'm facing. Under static conditions, the rope works ok. If a player just hangs off of it and nothing changes about the situation, Unity will be able to resolve the simulation correctly. The issue arises when the player's rope/tongue either attaches to a moving platform or gets pulled by some other object like the floating platform in the game prototype above. Unfortunately, that's the main method of locomotion in my game and I'm having a really hard time finding a solution to it.

Share this post


Link to post
Share on other sites
So we were never able to fix the bug with the rope using hinge joints, which is unfortunate because we like the rope's flimsiness when made out of discrete components. What we ended up doing is getting a static image for the rope , stretching it as the player changes the tongue's length. It actually looks moderately decent but still requires some work. The most important thing is that they are stable. What I have also tried just drawing a curved rope based on player's velocity , but it just ended up making the tongue Iook like a PVC pipe.

Share this post


Link to post
Share on other sites

I'm late to the party, but did you try all the basics of mucking with the physics settings to try to get more stability?  Solver iteration counts, physics timesteps, etc?

Share this post


Link to post
Share on other sites

You know, I can't actually remember if we did bother with that. I think I still have the code on a branch somewhere so I might just go back and test it to see, but I think we'll roll with this setup from here forward.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!