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
2
Question by MDennis · May 31, 2011 at 09:22 AM · colliderplayerobjectsfalling

Player falling too fast for a collider to stop it

Hello,

I have a little problem where if i let my character fall for too long, and they are going to collide with an object that is a tree branch for example, i would like the character to stop, but they seem to always fall through the collider. I understand that this may be caused by the fact that the character is falling too fast, but is there a possibility to be able to stop the character from falling through objects?

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 cregox · Sep 27, 2011 at 06:13 PM 0
Share

related: http://answers.unity3d.com/questions/55179/cheapest-way-to-catch-collisions-on-very-fast-movi.html - and by the way, your forgot to give us a link to your game! or at least a trial. :D

avatar image Kacer · Sep 27, 2011 at 06:16 PM 0
Share

oh, i actually remember this question :D

i wanna seeee

5 Replies

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

Answer by iggy · May 31, 2011 at 09:30 AM

Well the easiest way i can think of if you set your important rigidbodies to "Collision Detection -> Continuous"

Continuous

Use Discrete collision detection against dynamic colliders (with a rigidbody) and continuous collision detection against static MeshColliders (without a rigidbody). Rigidbodies set to Continuous Dynamic will use continuous collision detection when testing for collision against this rigidbody. Other rigidbodies will use Discreet Collision detection. Used for objects which the Continuous Dynamic detection needs to collide with. (This has a big impact on physics performance, leave it set to Discrete, if you don't have issues with collisions of fast objects)collisions of fast objects)

Source: http://unity3d.com/support/documentation/Components/class-Rigidbody.html

Edit: now that i think of it, it probably won't help when player is moving fast, only when Rigidbody is moving fast. So if you character has Rigidbody you can set its Collision Detection to Continuous or if it uses Character Controller you can limit the Fall Speed with setting "Drag" > 0

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 MDennis · May 31, 2011 at 09:39 AM 0
Share

Thank you for the answer, it does work, but i may just alter my level designs to remove the ability to free fall for so long :)

avatar image
3

Answer by Kacer · May 31, 2011 at 09:53 AM

you could also use a raycast to see if you're near a collider, and tell your object to stop when you get too close to the 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
2

Answer by save · May 31, 2011 at 09:43 AM

As iggy said all important objects should have Continuous or Continuous Dynamic collision detection. But when an object reach a certain magnitude the calculations won't keep up anymore as the object is moved past the collider with no step in between.

You could use check for distances and height to a collider beneath. Then if that distance is

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 save · May 31, 2011 at 09:52 AM 0
Share

Tried to edit the above but then I accessed the actual html, didn't dare. :) Just wanted to say that there's also good practice to have a maximum velocity limit of important rigidbodies.

avatar image iggy · May 31, 2011 at 09:55 AM 0
Share

yes, that could work too, casting a Ray to check if there is ground below or something like that.

avatar image
0

Answer by cregox · Sep 27, 2011 at 06:12 PM

Adding to iggy's answer, DontGoThroughThings is what you need. Raycasting is the idea, though not quite the way Kacer pictured. It basically checks if it crossed any object between two frames in which the player moved too fast.

It sure worked in my case, in which I had several objects in the scene at the same time that would kind of "explode" and should be contained inside a box. To me, it was as easy as adding the script to those objects.

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 IrridiumMonkey · Feb 20, 2013 at 07:33 PM

Yes, that also worked for me, Thank you! :D

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 cregox · Apr 09, 2013 at 07:35 PM 0
Share

definitely not an answer! :(

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Have script detect which collider 2 Answers

Player(box) randomly falls through objects. 1 Answer

How to Move Player in Particular Direction Without holding Down a Button? 0 Answers

OnTriggerEnter2D not triggering 2 Answers

I am getting player tag not the other object that i want to destroy. 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