Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by DerLasseHenrich · Aug 09, 2018 at 11:30 AM · 2d gametop-downropehingejoint2dchain

Chain in 2D top down perspective.

So I have my android game, it's called Racers, and I want to add a new weapon. The weapon should be a rope or chain with maybe like a heavy steel ball on the end. The chain is fixed on the racer. I want the the player can pull the ball with the chain over the field. A bit like in Skull Chainz (https://chaoclypse.itch.io/skullchainz) To get you a closer look what I mean, here's my game: https://play.google.com/store/apps/details?id=com.HenrichProductions.Racer So how do I do that? I tried it with hinge joints, but they fly apart and due to their weight they pull the Racer back. Another problem is that the Racer is constantly rotating and the chain keeps stiff and rotates like a stick with the racer, but I want it to swing. Please help me :(

Comment
Add comment · Show 2
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 brendanperry05 · Aug 09, 2018 at 02:25 PM 0
Share

You should probably add multiple hinge joints for every link in the chain, and edit the breakForce to be unbreakable

avatar image DerLasseHenrich brendanperry05 · Aug 09, 2018 at 09:20 PM 0
Share

Even with 4 hinge joints and break force to Infinity nothing changes. The chain links continue flying apart.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DerLasseHenrich · Aug 10, 2018 at 09:32 PM

So I found the issue. To not pull the Racer back, I've set the masses of the links to 0.001. That's why the chain kept stiff. So now all the masses of my links ( except of the last one which is heavier ) are set to 1. The mass of the Racer is set to the Highest, so it isn't affected by the chain. I don't know why it flew apart, but now it doesn't do that anymore, so... it's working.

Comment
Add comment · Show 2 · 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 unity_1010meha · May 15, 2019 at 09:41 AM 0
Share

Hey! I'm still struggling with making a ball and chain mechanic on my game, $$anonymous$$d sharing your code for reference? $$anonymous$$y code looks like this right now, the main problem is that the distance between the anchor and connected anchor just keeps changing. using System.Collections; using System.Collections.Generic; using UnityEngine;

 public class DragandDrop : $$anonymous$$onoBehaviour {
 
     private bool selected;
     public HingeJoint2D joint;
 
     void Start()
     {
         HingeJoint2D joint = GetComponent<HingeJoint2D>();
 
 
     }
 
     void Update()
     {
         
         if (selected == true)
         {
             Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             Vector3 mouseLocalPosition = transform.InverseTransformPoint(cursorPos);
 
             joint.connectedAnchor = cursorPos;
             joint.anchor = mouseLocalPosition;
 
         }
         Debug.Log(Input.mousePosition);
 
         if (Input.Get$$anonymous$$ouseButtonUp(0))
         {
             selected = false;
         }
     }
 
     void On$$anonymous$$ouseOver()
     {
         if (Input.Get$$anonymous$$ouseButtonDown(0))
         {
             selected = true;
         }
     }
 
     
     
 }
 
avatar image DerLasseHenrich unity_1010meha · May 17, 2019 at 01:59 PM 0
Share

Hey! For that purpose I used a Distance Joint ins$$anonymous$$d of a Hinge Joint. Let me know if that works!

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.

Follow this Question

Answers Answers and Comments

102 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D Top down physics with ground (slippery floor...) 1 Answer

Custom Cursor hidden behind my UI 2 Answers

Need a critique of my weather code (top-down 2D) 0 Answers

How to access a tile? 1 Answer

2D custom sort axis not working at all 2 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