• 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 Daniel 8 · Jun 29, 2010 at 05:53 AM · guicollidergame

Hey guys, I want to no how to go inside an object with a collider but to still collide with it?

All I want is for my character to be able to go inside an object as if it wasn't there, but i still want the gui to show up .onCollision?

Is this Possible?

My script is:

var showGUI: boolean;

function OnCollisionEnter(coll: Collision) { if(coll.gameObject.tag == "Hint") showGUI = true; }

function OnCollisionExit(coll: Collision) { if(coll.gameObject.tag == "Hint") showGUI = false; }

function OnGUI() { if (showGUI) { GUI.Box (Rect (10,10,100,90), "Loader Menu");

 // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
 if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
     Application.LoadLevel (1);
 }

 // Make the second button.
 if (GUI.Button (Rect (20,70,80,20), "Level 2")) {
     Application.LoadLevel (2); 
 } 

} }

Comment
Add comment · Show 2
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 0V3RWR173D · Jun 29, 2010 at 05:57 AM 0
Share

So you want it to collide with other things but not the player?

avatar image Daniel 8 · Jun 29, 2010 at 06:04 AM 0
Share

what i want is like a hint box, you can move through it but when the player touches it the gui comes up

2 Replies

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

Answer by Eagle32 · Jun 29, 2010 at 06:05 AM

It sounds like you probably want the object your character is walking into to be a trigger rather than a collider.

Quoting the BoxCollider page of the Reference Manual

Triggers

An alternative way of using Colliders is to mark them as a Trigger, just check the IsTrigger property checkbox in the Inspector. Triggers are effectively ignored by the physics engine, and have a unique set of three trigger messages that are sent out when a collision with a Trigger occurs. Triggers are useful for triggering other events in your game, like cutscenes, automatic door opening, displaying tutorial messages, etc. Use your imagination!

Then you just use OnTriggerEnter (other : Collider), etc rather than the OnCollision versions.

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
1
Best Answer

Answer by Deikkan · Jun 29, 2010 at 06:06 AM

The thing that comes to mind first is setting the collision to be a trigger.

So instead of:

    function OnCollisionEnter(coll: Collision) {
 if(coll.gameObject.tag == "Hint") showGUI = true; } 

It would be:

    function OnTriggerEnter(other: Collider) {
 if(other.gameObject.tag == "Hint") showGUI = true; } 

On the gameobject that contains the collider, make just the Is Trigger box is checked.

EDIT: Looks like a reply was posted while I was typing. I'll leave this up here incase it is still useful.

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 Daniel 8 · Jun 29, 2010 at 06:19 AM 0
Share

cool, thanks that was alot of help

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers

I need help with a script(brauche hilfe mit einen Script) 0 Answers

OnCollision Script... 2 Answers

How to make an object fallow you and disapear 2 Answers

Destroy GameObject and play sound 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