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 Jun 24, 2013 at 01:24 AM by AlucardJay for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by RaduMitroi · Jun 23, 2013 at 08:11 PM · collisionobjectdestroyanother

Destroy an object with another one.

Hi, I want to destroy an object (in this case a chain) when its touched by another object (a bolt cutter). I made the bolt cutter pickuable like in Amnesia and I want to make so when you go with the cutter in the chain, the chain will be destroyed. Hope you understand what I want. Is there a way i can do this ? Thank you!

Comment
Add comment · Show 2
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 cdrandin · Jun 23, 2013 at 08:14 PM 0
Share

Do you mean full on realism? You cut a small piece of the chain and then both parts fall off on their own? Or do you mean calling the Destroy function?

avatar image RaduMitroi · Jun 23, 2013 at 08:19 PM 0
Share

I mean using the Destroy function. I need to use the box collider from the chain object and make a script saying that when the object(Bolt cutter) enters the chain's box collider destroy the chain object or something like that, right ?

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by bubzy · Jun 23, 2013 at 08:20 PM

 //pseudocode
 
 OnTriggerEnter(collider other)
 if(other.tag == "boltcutter")
 {
 destroy(gameObject)
 }

you might want to check out the onTriggerEnter section of the scripting reference

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnTriggerEnter.html

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 RaduMitroi · Jun 23, 2013 at 08:37 PM 0
Share

Thank you, it work perfectly, there were some erreors (I don't know if you if you put then intentionally), but i figured it out by looking at the link. The final code is:

 function OnTriggerEnter(other : Collider){
 
     if(other.tag == "boltcutter") {         Destroy(gameObject);     } }
avatar image bubzy · Jun 23, 2013 at 08:43 PM 1
Share

not intentional errors, just not actual code :) mark the answer as accepted to clear up the list :)

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

Collision with a coin 0 Answers

Destroying Gate by hitting a switch 1 Answer

Problem with collisions and Destroy(gameObject). 2 Answers

If two of the same objects spawn on top of each other, is it possible to destroy only one? 0 Answers

Make an object destroy the object it is touching? 2 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