• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by Tecnophobe · Oct 10, 2015 at 12:51 AM · physicsjointsjointropeswinging

How to do rope swinging?

It looks like this question has been asked a bunch of times. But none of the answers really answer my question. I want to make a game in which the player can do spiderman-like web swinging. To elaborate, spiderman attaches his web to some object and then, using his web as a rope, swings from that point. In this case, raycast to find where the player is aiming at, place an anchor there and start swinging from it. Simple enough, right? Yet I can't for the life of me figure it out.

alt text

I've been struggling with this for the larger part of my night. Trying mostly with joints, even though I have little experience with them. I tried configurable joint linear limit, which really seemed to be it for a while, but it anchors the player to his own position and not the anchor. I tried changing the anchor settings of the joint, but that makes it all glitchy and weird. I tried placing a cylinder between the player and the anchor and attaching it to both but that was just a big mess from the start.

What's the best way to do this sort of thing? I feel like there's a stupid simple method I just haven't thought of yet.

swinging-screenshot.png (20.6 kB)
Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Tecnophobe · Oct 10, 2015 at 01:29 PM

http://gamedevelopment.tutsplus.com/tutorials/swinging-physics-for-player-movement-as-seen-in-spider-man-2-and-energy-hook--gamedev-8782

I found this article written by the guy who made Spider-man 2 about slinging in videogames. If you know a thing or two about game physics and C# like me, this might be the better option for you. I was able to implement this in a bit over an hour.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Duodecimus · May 03, 2018 at 07:34 AM

http://www.raywenderlich.com/171250/make-2d-grappling-hook-game-unity-part-1 Is a guide on implementing a rope similar to the one used in the Worms games.

Short answer:

  • Add a Dynamic Rigidbody2d Component to your hero

  • Shoot a Raycast from the hero towards the mouse/target (remember to use a layer mask!)

  • Stick a dummy object with a Kinematic rigidbody2d component at the collision point

  • put a distance joint2d on the dummy object, with the other end attached to you hero

  • Marvel at clean swinging motion

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity VR Gun Slider Joint is glitching when pulled to the limit, glitching when pulling wrong direction 0 Answers

chains for a battering ram 0 Answers

How to swing with a rope like Spider-Man in Unity3D 1 Answer

How do I make nonstretchable rope with Configurable Joints?,How do I make non-stretchable Configurable Joint? 0 Answers

How to keep Configurable Joint from stretching? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges