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 May 06, 2013 at 07:25 PM by fafase for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by JordonRenn · May 06, 2013 at 06:55 PM · javascriptfpsragdolldestroy objecthealth

Make Body go limp after dead

Ok, so I'm workin and an fps survival type game. I have a healthh script and when my health < 0 it call a "Dead" function and will destroy game object.

How would I script it to go limp (Like ragdoll?) fall to the ground according to physics and the destroy object(on a timer?)

I kind of have an idea but I'm still learning Javascript in Unity.

 function Dead()
 {
     Debug.Log("Im Dead");
     //destroy enemy
     Destroy(gameObject);
 }
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

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by ExTheSea · May 06, 2013 at 07:00 PM

So for the ragdoll: You have to create a ragdoll replacement for your Gameobject. To do that you can use the ragdoll wizard ( http://docs.unity3d.com/Documentation/Components/wizard-RagdollWizard.html ).

To destroy the replacement you attach a script to the ragdoll containing something like this:

 var destroyTime : float = 10.0f;
 
 function Start(){
 Destroy(gameObject, destroyTime); //Not quite sure if it really uses a float or an int.
 }

Then if you call Dead you destroy your current "alive" Gameobject ( or move it somewhere or deactivate it whatever suits your purpose ) and Instantiate the Ragdoll at the position and with the rotation of the "alive" GameObject.

Hope it helps.

Comment
Add comment · Show 3 · 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 JordonRenn · May 06, 2013 at 11:04 PM 0
Share

Thanks for the quick answer!!

I knew it would be simple

avatar image JordonRenn · May 08, 2013 at 12:52 AM 0
Share

How would I Instantiate the ragdoll at the exact position and everything?? You know so it would look seamless?

I haven't tried this yet but I've been thinking about how it's do that

avatar image ExTheSea · May 08, 2013 at 04:51 PM 0
Share

You could do something like this:

 function Dead(){
 Instantiate(Ragdoll, transform.position, transform.rotation); //First use the player to get the position and rotation
 Destroy(gameobject); //Then destroy the player
 }

I myself use similar code for my ragdoll-spawning.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Health Script 1 Answer

health script will not work 2 Answers

Enemy health script using raycast not destroying tagged object 1 Answer

An instance of type (Script) is required to access non static member (Script) 1 Answer

Looking for skilled individual to assist with problem 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