Advertisement

Variable range rope physics.

Started by November 03, 2015 09:33 PM
4 comments, last by boogyman19946 9 years, 3 months ago

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?

Yo dawg, don't even trip.

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.
My current game project Platform RPG
Advertisement

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.

Yo dawg, don't even trip.

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.

Yo dawg, don't even trip.

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?

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.

Yo dawg, don't even trip.

This topic is closed to new replies.

Advertisement