Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
0
Question by Arfenhaus · Jul 06, 2016 at 04:35 AM · triggerfreezeparentingprojectiles

Get axe/arrow to stick to object

I'm trying to get an object/projectile to stick to a tree, I've looked up other answers and have tried to implement, still don't understand why it's not working.

-Rigidbody on Axe object.

-Rigidbody and Box Collider Trigger on tip of axe edge in an empty child object of the Axe object.

-Script attached to child object with Trigger.

-Tags are all appropriately set.

-The objects make physical contact, it just doesn't stick when the trigger hits or even Debug.Log.

     public void OnTriggerEnter(Collider other)
     {
         if (other.tag == "Climbable")
         {
             Debug.Log("grappled");
 
 
             Rigidbody pb = this.GetComponent<Rigidbody>();
             Rigidbody r = axe.GetComponent<Rigidbody>();
             //Collider x = axe.GetComponent<Collider>();
 
 
 
             r.isKinematic = true;
             pb.isKinematic = true;
             // pb.velocity = Vector3.zero;
             axe.transform.parent = other.transform;
 
         }
 
 
     }

Comment
Add comment · Show 3
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 Derenger21 · Jul 06, 2016 at 05:00 AM 0
Share

If you've got no errors and your debug.log line isn't printing, the only answer I could see is typo in your tag comparison.

Sorry to be condescending but if you're not getting the debug line out then you're not entering the IF statement.

Further, add a debug line above the if statement to log if the collider triggers, just to be sure.

is your axe head box collider set to isTrigger?

If none of this applies, maybe screenshots and code of relevant objects like Axe/Tree?

avatar image Arfenhaus Derenger21 · Jul 06, 2016 at 05:16 AM 0
Share

I'm getting the trigger to trigger now, the if statement is being called, problem is it's being called mid-air without hitting any colliders. So the axe gets instantly stuck in mid-air after a short distance.

avatar image Derenger21 Arfenhaus · Jul 06, 2016 at 06:36 AM 0
Share

all in all that's great news!

Check the bounds of all colliders. Ensure the axe head isn't colliding with the axe body?

I haven't checked this but as far as i know you should be able to debug.log (other.transform.name); To tell you the gameObject name of what it collides with.

0 Replies

· Add your reply
  • Sort: 

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

71 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 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 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 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 avatar image avatar image avatar image

Related Questions

Mess up with triggers, colliders and all this stuff :( 0 Answers

How can I simulate a thread? 1 Answer

Scene freezes when I restart level 0 Answers

Unity keeps crashing in while loop 1 Answer

Freeze 2D GameObject 0 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