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 aleem.razzaq09 · Feb 01, 2013 at 06:44 AM · rigidbodycollsion3dobject

Make transparent 3d object with collision detection

I am newbie in unity3d, I just want to make a square area which will should be transparent and when a object enter into that square area or touch that area then I should let know that some object enter or touch area. Kindly let me know or suggest me how can i do this task. This will be great for me. Thanks in advance.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Remaille · Feb 01, 2013 at 08:11 AM

What you want is a GameObject with a collider marked as "trigger" and a script reacting to the OnTriggerEnter event.

Here's how you can do it :

  • Create an empty GameObject

  • Add the component Physics/Box Collider to the object (other shapes are ok too)

  • Tick the option "Is Trigger" in the box collider properties

  • Create a script for this gameObject

  • Add the functions OnTriggerEnter, OnTriggerStay, OnTriggerExit to your script. And do whatever you want to happen in them.

documentation for OnTriggerEnter documentation for OnTriggerStay documentation for OnTriggerExit

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
2

Answer by archaismic · Feb 01, 2013 at 08:13 AM

make a cube or plane or whatever shape via

GameObject->Create Other->Cube

put it where you want it and go into the inspector and click "Is Trigger"... this will make the box so you can walk through it

then remove the mesh renderer component and it will be invisible

you can then refer to the name of your Cube in a script to trigger events

then click the alt text


make_cube.jpg (88.4 kB)
make_cube_1.jpg (62.7 kB)
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 Bluntweapon · Feb 01, 2013 at 07:33 AM

Make a cube, delete the Mesh Renderer, add a collider and make it a trigger.

Now you can attach a script onto the object with

 void OnTriggerEnter() {
     AlertOtherObject()
 }

or if you use UnityScript

 function OnTriggerEnter() {
      AlertOtherObject();
 }

Check this page for more info

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 aleem.razzaq09 · Feb 01, 2013 at 07:56 AM 0
Share

Thanks and got it, and second object which is going to enter in that area should be rigidbody or just add collider on it, because when I was adding rigidbody on it, it repells on touch and start moving?

avatar image Bluntweapon · Feb 01, 2013 at 08:01 AM 0
Share

Ok there were like 3 things wrong with my original anwser, my apologies. You really should be using

 void OnTriggerEnter(){
 }

ins$$anonymous$$d.

Second, yes the second object should have a Rigidbody (or CharacterController) attached.

If that's going to be a problem, however...well I guess you can always use a kinematic Rigidbody.

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

12 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

Related Questions

Get current position of object in another objects after collision. 0 Answers

Cloud recognition in Vuforia 0 Answers

How to compare position of two child of different parent's object. 1 Answer

rigidbody.AddForce affects all clones 1 Answer

Stop rigidbody from sliding down "stairs". 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