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 Daniel G · Jul 04, 2013 at 12:11 AM · javascriptrigidbodytags

Using "Tag" to disable Rigidbody Constraints

Hello, I cant figure this out for the life of me. How do I correctly reference all the tagged objects and remove the reigidbody constraints from them?

     //Cause the menu to FALL to the Ground
     GameObject.FindGameObjectsWithTag ("MainMenu");
     rigidbody.constraints = RigidbodyConstraints.None;

Thanks, Daniel

Comment
Add comment · Show 1
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 Daniel G · Jul 04, 2013 at 12:34 AM 0
Share

Just to be clear I am using JavaScript for anyone looking at this question in the future.

1 Reply

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

Answer by iwaldrop · Jul 04, 2013 at 12:13 AM

You have to store the reference that FindGameObjectsWithTag returns, then loop through them and do your thing.

 GameObject[] gos = GameObject.FindGameObjectsWithTag ("MainMenu");
 foreach (GameObject go in gos)
     go.rigidbody.constraints = RigidbodyConstraints.None;
Comment
Add comment · Show 10 · 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 Daniel G · Jul 04, 2013 at 12:20 AM 0
Share

@iwaldrop Im getting two errors here, Since i have no experience with using tags yet could you explain how to fix it? Btw heres the code as well:

 function On$$anonymous$$ouseDown () {
     audio.clip = SelectSound;
     audio.Play();
     //$$anonymous$$ove to multiplayer$$anonymous$$enu First
     //Cause the menu to FALL to the Ground
     GameObject[] gos = GameObject.FindGameObjectsWithTag ("$$anonymous$$ain$$anonymous$$enu");
     foreach (GameObject go in gos)
     go.rigidbody.constraints = RigidbodyConstraints.None;
     iTweenEvent.GetEvent(menuCam, "$$anonymous$$ain$$anonymous$$enuTo$$anonymous$$ultiplayerOptions").Play();
 }



alt text

Thank you btw for your Quick Response!

avatar image iwaldrop · Jul 04, 2013 at 12:21 AM 0
Share

You need to include the errors that you're getting with questions about error messages.

avatar image Daniel G · Jul 04, 2013 at 12:24 AM 0
Share

@iwaldrop hmm, I did for some reason the picture didnt go through here is another picture alt text alt text

screen shot 2013-07-03 at 8.24.04 pm.png (78.7 kB)
screen shot 2013-07-03 at 8.19.01 pm.png (94.0 kB)
avatar image iwaldrop · Jul 04, 2013 at 12:27 AM 0
Share

Shoot. I hate when that happens. It's probably because your using JavaScript and I wrote that in C#. Try this, but I have no idea if it'll work or not because I'm not that familiar with Unity's javascript implementation.

 var gos = GameObject.FindGameObjectsWithTag ("$$anonymous$$ain$$anonymous$$enu");
 for (int i = 0; i < gos.Length; i++)
     gos[i].rigidbody.constraints = RigidbodyConstraints.None;
avatar image Daniel G · Jul 04, 2013 at 12:29 AM 0
Share

Yes it is in JavaScript sorry i didn't define that :P, let me see here looks WAY more familiar to me :D giving it a try.

Show more comments

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

15 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

Related Questions

Multiple Cars not working 1 Answer

Integer in if statement, scripting help 1 Answer

Simple code is not recognizing tag anymore. 0 Answers

Attach object as child using code 1 Answer

Changing material Color using RBG? 3 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