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 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
Add comment · 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

· Add your reply
  • Sort: 
avatar image
1
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
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

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

Mouse Look Script 1 Answer

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

For Loop Won't Stop Running... 1 Answer

how to automatically set borders according to the screen size? 1 Answer

How To Stop An Audio Clip if it's Playing More Than 2 Sounds? 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