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 /
  • Help Room /
avatar image
0
Question by Mesut · Dec 09, 2010 at 10:51 AM · charactercontrollerstopcenteredge

character controller problem

hi folks, my problem is, that I want to prevent my character from falling down the edge of a platform. I could use an invisible wall, but I want to make it stop in its center, so my character could collide with something that's floating after the edge. Thought of various solutions but there's nothing useful coming to my mind.

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

Answer by Proclyon · Dec 09, 2010 at 11:04 AM

Use a SweepTest or CapsuleCast that represents the character to make an imaginary clone of your character controller. At the new location (Walk distance + 0.5 seconds?), now you have a short range scanner for falling and you can recognize the problem. Probably will need to get all colliders at that place.

Here's my own capsule cast Q&A which can shine some light on a similar problem

Here's the capsule cast script reference (Requires unity 3.0 or higher)

Here's the SweepTest (which projects the rigidbody itself rather than a collider)

Remember that you need to use a little tweaking and messing around with all this just to get it right. Is there no collider at +x 10 and -y 50? Well what if there is something in between? That will complicate things with casting, so u need to force transform a certain scan position. It's kind of tricky.

Now if you aren't thinking (this is to complicated) yet. I have to tell you. It is......

Simply go for invisible wall or set the object at the edge on a script or property that denies walking. Such as a script that gets the object on it if it has a character controller and sets it as child as long as the transform is on a certain X and releases it if you try to move to the "not fall down" side.

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 Mesut · Dec 09, 2010 at 11:11 AM 0
Share

thank you, have to think and read about it, but that may be it...I'll let you know if it was ^^

avatar image R-GiGgS84 · Sep 28, 2011 at 09:17 AM 0
Share

Hi there, i am currently trying to use the Capsule Cast to solve the same problem but i just dont seem able to do it. can kindly advice on it?

avatar image
0
Best Answer

Answer by oliver-jones · Dec 09, 2010 at 10:55 AM

I'm not really fully understanding your question (It could be me being a dumb a**). Let me try and understand your scene. Your character is on a floor (plane) and when he walks off, you don't want him to fall off the plane (floor)?

Could you explain your scene better?

You could increase the size of your characters collider?

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 Mesut · Dec 09, 2010 at 11:03 AM 0
Share

hehe, my character walks to the right and is wider than high, so when he walks towards an edge, there would a part of him surpassing the edge without him falling from the plattform. His legs are in the center of the character controller. When I put a invisible wall after the edge of the platform his "belly" can't surpass the edge. I want him to push a button he can only reach that way. I hope you get the idea =)

avatar image
0

Answer by OZAV · Apr 25, 2016 at 02:46 PM

. ..and, again, as i always say, this is kinda thread that will NEVER get old, as long a people make games in Unity. *Good that admins did NOT have it closed, thanks. So, here, (for now, and all future readers of this thread): you need to make in CODE, and define IN CODE a Square Matrix, after which bound player is considered out of it. Here's the (my simpler version) you can use, and additionally modify, for the task (you only MUST drag your center of your each map each time to be 0,0,0, in coordinates, for using this script in SUCCESSFUL manner) So, any objects you want to limit how far, or high it can go, just attach this script to it, and enter desired limits in Inspector: (*you may also add your damage call line, later, as well): here, my clean "LimitWorldBoundaries" script: LimitWorldBoundariesScr


limitworldboundaries.zip (926 B)
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 Owen-Reynolds · Apr 25, 2016 at 02:48 PM 0
Share

Usually better to post the script (is that first thing a link? They tend to go bad.)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Special collision for players 1 Answer

How to smooth the movement of the camera? 0 Answers

Boat Controller Help 0 Answers

fps script not working 1 Answer

The type or namespace name 'CharacterController2D' could not be found 2 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