Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Matt Woods · Jun 17, 2011 at 07:46 PM · colliderlevelboundaryinsideconcave

Using a collider to define the boundary of a level?

I am working on an underwater game where the user pilots a submarine around an underwater world. I would like to create an invisible spherical wall around the important part of my level, so that the user can't leave the area (though they can see terrain extending beyond it) I thought I could do this by just putting a giant spherical collider on a null game object centered in the level. Unfortunately, the spherical collider seams to assume that other colliders should always remain outside of it, and will force rigid bodies with colliders outside of the sphere. Is there a way to create a spherical collider that will instead contain colliders, and prevent them from leaving?

Thanks,

-Matt

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 Chris D · Jun 17, 2011 at 08:12 PM

I think your options may be limited here...here's something to try, though:

  1. Model your level boundary (correct size) in a modeling program (eg. blender)

  2. ensure your normals are flipped

  3. import to unity and use a mesh collider

The caveat being that I'm not entirely sure how unity generates mesh colliders on import (I'm assuming from surface normals).

Comment
Add comment · Show 8 · 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 Anxo · Jun 17, 2011 at 08:21 PM 0
Share
  • good one. I am always thinking in mobile game terms. And if it is not a mobile game, this should work just as you wanted $$anonymous$$att.

avatar image Chris D · Jun 17, 2011 at 08:23 PM 0
Share

Ah, nice - wasn't quite sure about it, but seemed like it should work.

avatar image Matt Woods · Jun 17, 2011 at 08:32 PM 0
Share

Brilliant. Just tried it out, and it works peachy keen. Thanks Chris!

PS. I'm not working on a mobile game, but do I infer from Anxo's comment that mesh colliders don't work in mobile? Thats good to know for future ref.

avatar image Chris D · Jun 17, 2011 at 08:37 PM 0
Share

No, I'm pretty sure they work on mobile. I think the concern was more one of performance (as using a mesh collider is kind of expensive to use), but I could be wrong.

avatar image Matt Woods · Jun 17, 2011 at 08:46 PM 0
Share

Gotcha. So it might be better to use a simpler mesh with fewer faces in mobile? A low poly cylinder or cube. I may change $$anonymous$$e to a cylinder anyway now that I'm going with a mesh.

Show more comments
avatar image
0

Answer by Anxo · Jun 17, 2011 at 08:13 PM

Hi mat, you can set the spherical collider to trigger. Then you can ad a

OnTriggerExit function to the player so that something happens when they try to leave. If want them to run into a wall you will have to build a box out of 6 boxes. I dont think you can invert a collider.

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 tstpierre_nss · Nov 22, 2012 at 03:25 AM

Here is another solution that we released today on the asset store.

It allows quick create of complex boundaries for a level.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Restrict character's movement within a level's map 1 Answer

Collision problems with level design 1 Answer

How to create/edit a scene/level from inside the game? 0 Answers

My object is going through boundaries Problem! 1 Answer

How to set a boundary around an object? 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