Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Dec 07, 2013 at 04:00 AM by AlucardJay for the following reason:

Duplicate Question : http://answers.unity3d.com/questions/591221/jungle-swing-type-of-game.html

avatar image
0
Question by Rams · Dec 06, 2013 at 06:07 PM · issuehingejointropewith

jungle swing type game ...?

Hi All, I am doing a simulation i.e of type jungle swing. I used hinge joints for the rope creation and top part is there to hold the rope. Below I attached both web player and code. I am about to do a jungle swing(Iphone application) type of thing. I am unable to instantiate the rope and all for the next position.Go through the thing which I did, and help me to complete it. please forward me to complete it.alt text Thanx in advance...

 using UnityEngine;
 using System.Collections;
 
 public class hingeCreation : MonoBehaviour {
 
     public GameObject sphere,cylinder;//sphere is for representation of the boy to swing, cylinder is for rope
     bool flag =true;
     public float x,y,z;// for initial rotation of the rope
 
     Vector3 scale;//for creating certain length rope
     public static bool stopScale;
 
     // Use this for initialization
     void Start () {
         //x=270.0f;
         //y=0.0f;
         //z=0.0f;
     }
     
     // Update is called once per frame
     void Update () {
 
         if(Input.GetMouseButtonDown(0)){
 
             Destroy(this.gameObject.hingeJoint); // to be implemented for inactivating rope for a while and creaing at a new position
             this.gameObject.SetActive(false);
 
             //Destroy(this.gameObject.transform.parent);
         }
 
         if(!stopScale){
             scale = cylinder.transform.localScale;
             scale.y += 0.09f;
             cylinder.transform.localScale = scale;
             
     }
     }
     void OnCollisionEnter(Collision col){
         stopScale = true;
         print(col.gameObject.name);
 
 
 
         if(col.gameObject.name == "collider" && flag == true){
             HingeJoint sphere = this.gameObject.AddComponent("HingeJoint") as HingeJoint; // creating the joint at the collision point
             this.gameObject.hingeJoint.breakForce = 100000000.0f;
             this.gameObject.hingeJoint.breakTorque = 1000000.0f;
             StartCoroutine("create",0.1f);
 
             flag = false;
         }
         
     }
     IEnumerator create(float t){
         yield return new WaitForSeconds(t);
         this.gameObject.rigidbody.useGravity = true;
         //this script is attached to rope(cylinder) firstly it will have no grvity, rope has a hinge we have to use grvity
 
         sphere.gameObject.GetComponent<FixedJoint>().connectedBody = this.gameObject.rigidbody;
         this.transform.parent.parent.gameObject.transform.eulerAngles = new Vector3(x,y,z);
         Invoke("Created",1.0f);
     }
     void Created(){
         sphere.gameObject.GetComponent<FixedJoint>().tag = "Infinity";// bob and rope will connect together 
         sphere.gameObject.GetComponent<FixedJoint>().tag = "Infinity";
         sphere.gameObject.rigidbody.useGravity = true;
 
     }
 }
 


app.jpg (12.6 kB)
Comment
Add comment
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

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

16 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

Related Questions

HingeJoint rope to pull object with another object 0 Answers

2 Hinges on the same object, like a swing. 0 Answers

2D hinge joint with sprite 0 Answers

game simulation using dynamic hinges generation issue...! 0 Answers

get a rigidbody rope move with my character 1 Answer


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