Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
4
Question by ButterCream87 · Nov 15, 2011 at 02:43 AM · collisionwalls

Player passes through walls

Player game object passes through walls.

Rigidbodies are not registering collision.

How can I fix it?

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

9 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by rob5300 · Jan 14, 2016 at 11:12 AM

Check how you are moving the player. There are a few reasons for why this could be happening:

If you are moving the player via physics, this should not happen. It then could be causes by various things such as the max penetration value in the Physics settings.

Remember of course all objects need colliders on them. Something you may not know is that two mesh colliders will not collider unless one is ether a Static object, or one is marked as Convex. This is built into Unity to prevent physics issues. If this is the case, try replacing the colliders with primitives such as Box colliders and test.

EDIT: Seems now in unity 5 its slightly different, here is what the doc says:

There are some limitations when using the Mesh Collider. Non-convex Mesh Colliders are only supported on GameObjects without a rigidbody. If you want to use a Mesh Collider on a rigidbody, it needs to be marked as Convex.

If you are moving the player via its transform.position, then you are going to encounter these issues, as there is no reasonable way for the engine to check if the player will collide until the next physics update.

Can you give us the code you are using to move the player? Preferably the whole script.

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 ycode · Feb 17, 2018 at 10:48 PM 1
Share

Thanks. Your answer helped in my case as well. Especially, the part,

It then could be caused by various things sub as the max penetration value in the Physics settings.

In my case, two game objects with collider penetrated or went through each other only when speed is higher than some extent, and I needed to configure the penetration in Physics configuration.


However, it took time to get to where I can configure the penetration. After all, I found that it seems to be called Contact Offset at the moment of version 2017.3.0f3. It is available at Physics $$anonymous$$anager that can be opened from Edit - Project Settings - Physics, but keep it in $$anonymous$$d that it is a default value. When it comes to individual, it seems not to be available on Inspector, although it is configurable in scripting, which is something looks like GetComponent<BoxCollider>().contactOffset = 5f

avatar image Mbahri58 · Jul 28, 2018 at 04:21 PM 0
Share

Hello rob. I have problems with player passes through walls. I'm using transform.position. What can i do?

CODE:

 joystick giriliVAl;

 Rigidbody2D mybody;

 public float speed;

 void Start()
 {
     giriliVAl = GameObject.FindGameObjectWithTag("Joystick").GetComponent<joystick>();
 }

 void Update()
 {
     transform.position += giriliVAl.giriliV * Time.deltaTime * speed;

 }

}

avatar image
3

Answer by seedoubleyou · Nov 15, 2011 at 05:49 AM

Do all your objects have Colliders on them? Are the Collider's "Is Triggers" box clicked on? (That's what used to get me in trouble)

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 emhz · Aug 06, 2015 at 07:23 PM 0
Share

all what you mention to do are done ,but still it pass the wall !!

avatar image fico_cofi · Jan 14, 2016 at 11:01 AM 0
Share

I also have this problem, but I don't now what i can to do... I searching on internet but there haven't fix....

avatar image
1

Answer by Rocketman123 · Sep 28, 2016 at 08:43 PM

even though i am a total noob (so don't take my word for it) the answer is to make the wall & floor (instead of a plane) into a cube that is thick. this partily solved my problems at least.

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 akale · Jan 15, 2016 at 05:43 PM

It is not Rigidbodies that register walls, its box colliders(or box colliders 2d). Try adding some colliders

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 SterlingSoftworks · Jan 15, 2016 at 06:31 PM

If you have a Rigidbody and all the proper Colliders and you're not ignoring the collisions via code or anything like that.. Try setting your Rigidbody's Collision Detection to "Continuous".

Discrete Detection: Checks the next frame "Is the collider touching another collider in this frame? If not, move there, if so, we collided"

Continuous Detection: Fires a Raycast in the direction of movement to check the collision before they happen.

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
  • 1
  • 2
  • ›

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

14 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

Related Questions

How can I get the closest point on a concave mesh to a world position? 0 Answers

handmade player object goes through walls 0 Answers

Dive collide 2 Answers

Enemy Cube going through walls. 1 Answer

Passing through walls. 2d toolkit 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