Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 tonydemot · Sep 04, 2012 at 02:34 PM · rigidbodymesharraybonesskinned

Adding a rigidbody to an array?

Iv got a model which is skinned and has bones in it, what i want to do is when the health reaches 0 I want all the bones to add a rigidbody onto them but i don't know how i would go about doing this in C#?

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 AlucardJay · Sep 04, 2012 at 03:42 PM 0
Share

You should look at using Ragdoll ins$$anonymous$$d : http://docs.unity3d.com/Documentation/Components/wizard-RagdollWizard.html

first video I found : http://www.youtube.com/watch?v=XSQATmz5Yn4

I learned ragdoll from the 3D Buzz tutorial. Click the below link, scroll down to : Section 4 - Integrating Animated $$anonymous$$aya Characters : 30 - Setup Ragdoll (also videos 31 and 32)

http://www.3dbuzz.com/vbforum/content.php?212

as you are in C#, you should follow along, to see how they replace their character with the ragdoll, recursively match all the limbs to the correct position and rotation, then hide your character and show the ragdoll. ($$anonymous$$iraSensei has shown how this can be done in his answer)

avatar image tonydemot · Sep 04, 2012 at 03:53 PM 0
Share

this is the model isn't a standard character its actually an animal which would be rather hard to put into a ragdoll i would imagine.

avatar image AlucardJay · Sep 04, 2012 at 03:55 PM 0
Share

No problem, just thought I'd put it out there in-case you wern't aware of it =]

Although it would be interesting to see what the Ragdoll wizard does to an animal shape ! $$anonymous$$y guess is that it would work quite well if you assigned the associated limbs correctly. What the ragdoll wizard does is add rigidbodys and colliders to certain parts of the skeleton, kinda what you're after? You should make a ragdoll just for fun and see what it does. It takes 1 $$anonymous$$ and makes a new prefab so your model isn't changed in any way =]

avatar image tonydemot · Sep 04, 2012 at 05:56 PM 0
Share

the model isnt in a T stance so i wont work :/

1 Reply

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

Answer by KiraSensei · Sep 04, 2012 at 03:45 PM

Did you already get an array of your bones ?

If not, you should start with this. Create an array that you fill with all the bones in the inspector, then loop on it and add the component !

 for (int i=0; i<bones.length; i++)
 {
     bones[i].AddComponent("Rigidbody");
 }

Have a look to : http://answers.unity3d.com/questions/41528/find-a-child-with-a-name-how-to.html

This may help you...

Comment
Add comment · Show 5 · 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 tonydemot · Sep 04, 2012 at 03:49 PM 0
Share

well also what i want to do is add the bone objects throught script eg finding them by tag or by name

avatar image tonydemot · Sep 04, 2012 at 08:44 PM 0
Share

thank you very much just one more thing i have attached some colliders on my model and if it's health reaches 0 then the colliders switch from triggers to colliders but the model still falls through the floor and i have all the floor with colliders on, any thoughts?

avatar image KiraSensei · Sep 04, 2012 at 09:13 PM 0
Share

What is exactly the confiduration ? The very important thing is that your floor should have a mesh collider, but your character should not. It can have a box collider, sphere ... but no mesh collider. 2 $$anonymous$$eshes colliders can work together only of one of them is convex (a check box in the inspector), but in your case it may not be the case ...

Just try an other collider on your player and tell me !

avatar image tonydemot · Sep 04, 2012 at 09:34 PM 0
Share

ahh it works now it was just becasue i had 1 collider on the spine of the model and the rest of the bones didnt have colliders but they had rigidbodies so they went throught the ground, iv attached all colliders to all bones and now i have to find a way of restricting the bones to go so far becasue when the model dies it streches in all directions but thanks for the help :)

avatar image KiraSensei · Sep 04, 2012 at 09:37 PM 0
Share

No problem :)

Colliders were not easy for me too. Don't forget to accept the answer please :)

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

8 People are following this question.

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

Related Questions

Smoothing Errors with Skinned Mesh Renderer 1 Answer

Position of skinned mesh with rigidbody on bones. 1 Answer

is it possible to affect bones on skineed mesh by wind? 2 Answers

Mesh deformation 0 Answers

Weird bounce on collision with perfectly aligned (generated) meshes for fast object 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