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 Wesker_Kai · Apr 19, 2012 at 03:00 PM · collisionphysicstrigger

Question about collision and trigger

Hi! I have done a game and have some problem about that. If a ball (Tag as player) hit the pipe(Tag as standard pipe), the ball will return to starting point(A empty object tag as respawn).

How can I write it? Should I need to tick the trigger box?(Ball have a rigid body)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Owen-Reynolds · Apr 19, 2012 at 03:18 PM

Take a look at the scripting reference for collisions. http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html has an example. Then browse around for those terms and you'll find plenty more examples like that and general info on colliders, triggers and so forth.

In general, Triggers and Colliders can both detect what "hits" them. Use a Collider for a "real" object, which most things bounce off of. Use a trigger for a "zone" (around a fire?, entrance to the library, ... )

You have your choice of whether the pipe detects when the player hits it (would need to add a script to the pipe, or add to existing one,) or whether the player detects when it hits the pipe.

If the ball is using a characterController (which is odd for a ball,) then you have to use a special one, that only works on the sphere. http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.html has the list of the "what happened this frame" functions. Take a look at OnCharControllerHit. There's an example.

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 Wesker_Kai · Apr 19, 2012 at 04:43 PM

  1. know there are many example, but the main problem is THERE ARE TOO MANY EXAMPLE!!! 2.Your explain of Triggers and Colliders are really outstanding. 3.That means I need 2 script?

Comment
Add comment · Show 1 · 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 Owen-Reynolds · Apr 20, 2012 at 11:17 PM 0
Share

If you can, try to put replies to an "answer" as comments on that answer. Helps for when someone else is searching through later.

"That means I need 2 script": See my 3rd paragraph. Only one place needs to check for the collision.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

If trigger hit, spawn it 1 Answer

Compound collider object behaving as a whole? 1 Answer

OnTriggerStay2D with many colliders 1 Answer

OnTrigger outside the trigger and collider gamobject 1 Answer

collider doesnt work the 2nd time 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