• 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
Question by GabrielSalvesen · Mar 08, 2014 at 10:27 PM · borderswont stopforce stop

I can't create a world border?

So i've almost completed my game. It is a 2D gamje where the character moves across this world trying to avoid the enemies. When I go up, the character never stops. Is there a way to create a simple world border around my world? Meaning, that the character stops at some point and doesn't continue to leave the map.

Comment

People who like this

0 Show 1
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 robertbu · Mar 08, 2014 at 11:00 PM 0
Share

This problem is typically solved by clamping the position of the character so that he cannot travel beyond a certain range. Less frequently it is handled by colliders around the edges of the map. A specific answer requires more information: how you are moving the character, your movement code would be helpful, verification that your map is on the XY plane, verification that your map is centered on the XY origin.

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by Gruffy · Mar 08, 2014 at 11:01 PM

if your world is effectively a square then line up, at each side, an empty gameobject with a box collider. if your player has a rigidbody or collider attached to it also, when you reach these box colliders at the edge of your world, they should stop you moving past the world edge. For surety, align each GameObject with it`s repsective BoxCollider (stretched out to cover the length of your world`s sides) and bring them into your world edge a little to ensure the collision happens before you actually fall of the world. ![alt text][1]

Overall, to give you a more succinct answer we would need to know how your player is being handled (Rigidbody or simple input triggered translation and rotation) You may find these links below helpful aswell. [Unity Student (in JS im afraid but that should be too scary)][2] And of course, the best place to start... [Unity Script ref: Collisions][3]

Take care and Thanks for reading. Gruffy [1]: /storage/temp/23323-diagram.png [2]: http://www.unity3dstudent.com/2010/07/beginner-b01-basic-collision-detection/ [3]: http://docs.unity3d.com/Documentation/ScriptReference/Collision.html


diagram.png (13.9 kB)
Comment
Jamora

People who like this

1 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Input.ResetInputAxes Doesn't Stop From Moving? 0 Answers

Mouse Look Script 1 Answer

How to make Timer stop upon Death? 1 Answer

Making map borders 0 Answers

Adding white border to boxes 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