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 Nov 27, 2013 at 01:11 AM by Bunny83 for the following reason:

Duplicate Question of your other question: http://answers.unity3d.com/questions/579699/attaching-two-gameobject-together.html

avatar image
0
Question by IAmJeff · Nov 27, 2013 at 01:08 AM · instantiateoncollisionenter

gameobject on gameobject

I have a bolt (for crossbows) prefab, when it hits the wall it doesn't get stuck at the wall (just goes right through it). However, when I pause after the collision, the hierarchy shows the the bolt becomes a child of the wall and its rigidbody and collider also gets destroyed. Any idea why it just passes through?

My alternate method is to destroy the bolt when it collides and replace a clone in its place. But doesn't seem to work either.

***I've attached the script to the wall. The bolt has a rigidbody and both the wall and the bolt have a collider.

     void OnCollisionEnter(Collision hit)
     {
         //float depth = 0.3f;
 
         if(hit.gameObject.tag == "Bolt")
         {
             //method 1
             //hit.transform.Translate(depth * Vector3.forward); ////doesn't seem to work
             //hit.transform.parent = transform;
             //Destroy(hit.gameObject.rigidbody);
             //Destroy(hit.gameObject.collider);
             
             //method 2
             hit.transform.parent = transform;
             GameObject clone = Instantiate(boltPrefab, transform.position, transform.rotation) as GameObject;
             Destroy(hit.gameObject);
         }
     }

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 Bunny83 · Nov 27, 2013 at 01:12 AM 0
Share

Don't post the same question multiple times. Usually if a question doesn't get an answer, the question or your situation / setup isn't clear enough to answer the question. You should edit your other question and provide some more information and updates on your progress.

http://answers.unity3d.com/questions/579699/attaching-two-gameobject-together.html

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Guided Missiles help? 2 Answers

destroy an instantiated object from oncollision enter 0 Answers

Collision between two instances of the same object 1 Answer

I don't think I get collision box, can someone help? 0 Answers

I want to A(enemy) touch B. Then B change to C 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