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 Michael 20 · Mar 21, 2011 at 08:41 PM · carexplosionfiredetonator

exploding a car

Hi

I am using the detonator kit from Unity. I am trying to make a car explode.

My question is that, the moment after I explode the car, how can I replace the car with a burned one?

Thanks.

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

4 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by flaviusxvii · Mar 22, 2011 at 06:31 PM

Destroy the car, Instantiate a burned car.

http://www.unifycommunity.com/wiki/index.php?title=OnCollideExplode

Comment
Add comment · 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
0

Answer by AngryOldMan · Mar 21, 2011 at 08:43 PM

var BurntPrefab : GameObject;

if (CarExploded == true) { Instantiate (BurntPrefab, transform.position, transform.rotation); }

Comment
Add comment · Show 2 · 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 Michael 20 · Mar 21, 2011 at 08:49 PM 0
Share

I attach this to the car or to the detonator?

avatar image AngryOldMan · Mar 21, 2011 at 09:20 PM 0
Share

insert in the cars existing script

avatar image
0

Answer by efge · Mar 22, 2011 at 06:56 PM

Take a look at the reference: Instantiating Prefabs at runtime

Comment
Add comment · 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
0

Answer by Kashaunzilla · May 09, 2011 at 03:08 AM

Ok this is very simple to do actually. You need to place a life component on your car. Here is the script for that.

var hitPoints = 100;
var explodedCar = Transform;
function ApplyDamage (damage : float)
{
    if (hitPoints <= 0)    
    {        
        return;
    }
    hitPoints -= damage;    
    if (hitPoints <= 0)
    {       
        var car = Instantiate(explodedCar, GameObject.Find("EXCar1").transform.position, Quaternion.identity);
    }
}

Ok here let me explain a little. The hitpoints is how much damage it has taken. Or life. So if you shoot it or throw a grenade or what ever and it reaches 0 then it explodes. So put it on the car, make sure there is a collider on it. Now create a empty gameObject and put it on the same position it is for the car. Rename it ExCar1, duplicate the script and rename the EXCar1 to EXCar2 anf make another gameObject called EXCar2. Now if you want, that that if you shoot it enoough times it will catch fire on the engine this is pretty easy as well. So create a new if statement under the instantiate part.

if ( hitPoints <= 30 )
{
    var fire = Instantiate(FirePrefab, GameObject.Find(Fire1S).transform.position, Quaternion.identity;
}

Ok now this function checks if it only has 30 life left and then it will find a gameObject called Fire1S, The S stands for Spawn. Create a empty gameObject and name it Fire1S. Place it where the engine is. Also create a new variable called var FirePrefab : Transform; and the transform should be fire particles. This should work for you and make sure that your weapon can apply damage.

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

Unity Explosion Framework didn't work 0 Answers

space shooting: same exolosions 0 Answers

i want to add fire shot at enemy gun explosion 1 Answer

Explosion Elimination script 2 Answers

Detonator Explosion Framework Black squares around fireball 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