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 /
avatar image
0
Question by Zeus__ · Dec 15, 2013 at 10:42 AM · rigidbodyhingejointrigidbody-collision

Rigidbody Problem - Scrolling elements

My problem is the combination of elements in the chain of Rigidbody that are scrolled. At the end of the chain is a trigger that is designed to transfer the last element to trigger the first, and vice versa. I even tried with elements hingeJoint and does not go. Does anyone have any idea how this can be solved? Preceded by some piece of code.

Comment
Add comment · Show 4
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 Statement · Dec 15, 2013 at 11:36 AM 0
Share

Could you please clarify what you mean by "scrolling" in the context of physics and rigidbodies. Are you using some GUI system like NGUI?

avatar image Zeus__ · Dec 15, 2013 at 12:49 PM 0
Share

there are elements "trigger_row-3 1 2 3 4 5 6 7 8 9 10 11 12 trigger_row8" box are objects not use any gui. Are moved by AXIS.X code:

  function Update()
 {
     if (Input.Get$$anonymous$$ouseButton(0)){
         if(Input.GetAxis("$$anonymous$$ouse X")<0){
     //Code for action on mouse moving left
         Physics.gravity = Vector2(-5f,0);
         row_3_colide.actives = true;
         
         actives = 0;
         
         }
         if(Input.GetAxis("$$anonymous$$ouse X")>0){
     
         Physics.gravity = Vector3(5f,0,1f);
         row8_colide.actives = true;
     
         actives = 0;
         
         }
     }
         
         GameObject.Find(row_3_colide.names).rigidbody.is$$anonymous$$inematic = true;
         //GameObject.Find(row8_colide.names).rigidbody.is$$anonymous$$inematic = true;
     }
     if (Physics.gravity == Vector2(2f,0))
     {
         //GameObject.Find(row_3_colide.names).rigidbody.is$$anonymous$$inematic = true;
         GameObject.Find(row8_colide.names).rigidbody.is$$anonymous$$inematic = true;
     }
 }



In row8 trigger

 static var names : String;
 static var count : int = 0;
 static var actives : boolean = false;
 
 function OnTriggerStay(colider : Collider)
 {
     names = colider.name;
 }
 
 function OnTriggerExit(colider : Collider)
 {
     if (colider.transform.position.x > GameObject.Find("row8").transform.position.x && GameObject.Find("row-3").name != null)
     {
         colider.rigidbody.drag = 1;
         //colider.rigidbody.hingeJoint.connectedBody = null;
         this.gameObject.GetComponent(Follow_1).actives = true;
         colider.transform.rigidbody.$$anonymous$$ovePosition(Vector3(-2.5f,2f,8f));
         //colider.transform.position.x = GameObject.Find("row-3").transform.position.x;
     }
     if (actives == true)
     {
         count++;
     }
     
 }
 function Update()
 {
     if (count == 4)
     {
         //GameObject.Find(row8_colide.names).rigidbody.is$$anonymous$$inematic = true;
         actives = false;
         count = 0;
     }
 }

In row-3 trigger

 static var names : String;
 static var count : int = 0;
 static var actives : boolean = false;
 
 function OnTriggerStay(colider : Collider)
 {
     names = colider.name;
 }
 
 function OnTriggerExit(colider : Collider)
 {
     if (colider.transform.position.x < GameObject.Find("row-3").transform.position.x && GameObject.Find("row8").name != null)
     {
         colider.rigidbody.drag = 1;
         
         //colider.rigidbody.hingeJoint.connectedBody = null;
         colider.transform.rigidbody.$$anonymous$$ovePosition(Vector3(9f,2f,8f));
         
         //colider.transform.position.x = GameObject.Find("row8").transform.position.x;
         //colider.rigidbody.hingeJoint = null;
     }
     if (actives == true)
     {
         count++;
     }
     
 }
 function Update()
 {
     if (count == 4)
     {
     //    GameObject.Find(row_3_colide.names).rigidbody.is$$anonymous$$inematic = true;
         actives = false;
         count = 0;
     }
 }

I just use gravity, any ideas?

avatar image Zeus__ · Dec 15, 2013 at 12:56 PM 0
Share

If I $$anonymous$$ousebutton click and axis right then all elements moving right if left moving left. Gravity is set on X axis. I expect scrolling all elements together some with constant distance. Because it will be game which I should nextly eli$$anonymous$$ate this elements from this kind of menu

avatar image Zeus__ · Dec 15, 2013 at 01:01 PM 0
Share

Sorry almost i forgot Follow_1 script static var hingejoint : HingeJoint; static var actives : boolean = false;

 function OnCollisionEnter(colider : Collision)
 {
 if (actives == true)
 {
     Debug.Log("$$anonymous$$olide obiekt:" + gameObject.name + " kolider: "+colider.gameObject.rigidbody);
     gameObject.AddComponent(HingeJoint);
     var otherBody = colider.gameObject.rigidbody;
     hingeJoint.breakForce = 45;
     hingeJoint.breakTorque = 45;
     hingeJoint.connectedBody = otherBody;
     actives = false;
 }
 }
 function Update()
 {
     
 }

This script should null-ing object in trigger, and transport to row_3 and next connect to another body

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

Trouble with rigidbody collisions while attached to Joint 0 Answers

hing joint issue,Hing Joint Issue in tow truck 0 Answers

How to make an arm with multiple, controllable joints? 2 Answers

2 rigidbodies moving throug one another 0 Answers

HingeJoint motor force behaviour 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