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 henris08 · Apr 27, 2014 at 12:00 AM · collisionrigidbodymesh collider

Colliding problems.

Hello everyone. I need to write a script which adds value of 2 to wood_left variable when axe collides with the tree. Okay, so I have a player and axe is child of player so they move together. But I got a little problem. Player does collide with the tree, but axe doesnt. Axe is a group of two parts what makes axe and both of these parts have mesh colliders on. But they just wont collide have no idea why. I`m sorry its just to hard to explain, I just cant. So could someone please (I hate when people ask for scripts while they give nothing, but I`m just gonna shoot myself I`m so confused) help me write this script, or give a short summary how it should look like. Oh and I forgot to mention I have tried putting the script on the player, it collides but it wont add 2+ to the Wood_left variable, I`ve changed the script to OnTriggerEnter instead of OnCollisionEnter and works fine except it walks through the tree.

So okay heres what I need: If axe touches the tree +2 is added to the wood_left variable and for them to collide not just ghost each other.

ANY help will be appreciated. :( :p

P.S. Sorry for the tags, the tag system is stupid it wont let me create my own tags but I HAVE TO add tags so how da should I know what tags have been used already by other people, It does gives suggestions but my suggestions were: vector 2 and samsung galaxy tab 2 so I choose vector 2... Sorry again. :)

Comment
Add comment · Show 4
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 meat5000 ♦ · Apr 27, 2014 at 12:06 AM 0
Share

You can't really collide two mesh colliders. Also, add a rigidbody.

BTW you can add whatever tags you like :)

avatar image henris08 · Apr 27, 2014 at 12:22 AM 0
Share

Ive changed axe to box colliders and its still aint workin

avatar image meat5000 ♦ · Apr 27, 2014 at 12:27 AM 0
Share

I have tried putting the script on the player, it collides but it wont add 2+ to the Wood_left variable

Go with this one. The adding +2 is easier to work out.

avatar image henris08 · Apr 27, 2014 at 12:51 PM 0
Share

At first I`ve somehow fixed that value of 2 is added to the Wood_left variable when only axe and no other collider touches it, but it still was going through it. After few more hours of playing with it, I have finally made that both of them actually collide, but now wood_left wont update. What the actual ... please help :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by henris08 · Apr 27, 2014 at 08:00 PM

Oh and another problem:

Axe is group of 2 objects && its a child of GameObject Player. Its obviuosly childed by Player only so they can move together without any scripting. Okay so let me explain whats the problem: Imagine: - is the grass/terrain whatever. T - is the tree. P - is the player. A - is the axe.

Edit:Picture added instead of text because it gets distorted after posting. ** I know I know I could have added real ''game'' pictures, but I dont have unity on this pc so sorry about that. Also anyway I hope u understood it. :) alt text


aa.png (5.4 kB)
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 ToxxicSin · Apr 28, 2014 at 03:55 AM 0
Share

For things like this, I have a script that sets the position of heldObject (i.e. the axe)to the players position plus Vector3.Forward This makes it so the axe is held infront of the player at all times, the problem is the axe can pass through things unless you script something else, or you could increase the size of the player's collider and then just make the tip of the axe a trigger.

avatar image henris08 · Apr 30, 2014 at 03:04 AM 0
Share

Nice, I`ll try that, cheers :)

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

22 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

Related Questions

Mesh Collider STOPPING Objects Instead of Detecting Collision 1 Answer

Problems with collisions while rotating a rigidbody 1 Answer

Mesh collider not colliding with ball properly 1 Answer

Anyway to make my object not fall through the floor without convex? 0 Answers

NavMesh Collision Detection? 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