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
0
Question by Skeletim · Feb 03, 2017 at 01:44 AM · collisioncollidermeshcollider

Random Collision on PlayerCharacter?

I have created a series of meshes when placed together create a house, and I created a few meshes that surround that walls and windows, etc to use as a collision mesh. I did not generate collision on the meshes on import because I was going to use my own. I placed the mesh, and added several empty game objects that I put MeshColliders on. I select my collision meshes that I want to use for the collision, and everything works fine. But as my PlayerCharacter is moving around, I can tell it is getting pushed aside on random collision that is not there. It's as if there are thin strings from the top to bottom and as the PlayerCharacter hits the strings, they slide around them after a small bump. It's noticeable but there is nothing there on my collision. I'm not able to post a video showing it as it hard to detect, but I can see it in multiple locations across my mesh. I know which collision mesh is causing the problem, as the issue is gone when I deactivate the object. The strange thing is that the mesh that is causing the problems is isolated to the "bottom floor" of the house, in which the PlayerCharacter isn't even intersecting with the collider. But as I said earlier, its as if random edges of the mesh are shooting upwards into the upper floor of the house. Is there any ideas or suggestions on how to fix this, or why it's even happening?

alt text

example.png (196.9 kB)
Comment
Add comment · Show 5
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 malkere · Feb 03, 2017 at 03:47 AM 0
Share

Add some Debug.Log() calls to when your player collides with something. If you know they're touching the floor tell it to ignore floor calls when you go to call Debug. You gotta find out what you're running into first. There's never anything strange going on and it will make total sense when you figure it out. try turning off all the other colliders if you know which one it is, and see what's going on. Or maybe try loading it up in blender and seeing if the mesh has an error or funky face somewhere.

avatar image Skeletim malkere · Feb 03, 2017 at 07:29 PM 0
Share

Well, I know its the bottom highlighted mesh in the above image because I disabled them individually to find the one as you suggested beforehand. But upon doing collision tests, I can not seem to get a script to work on that. I'm assu$$anonymous$$g this is correct? using System.Collections; using System.Collections.Generic; using UnityEngine;

 public class TestCollisionBug : $$anonymous$$onoBehaviour {
 
 void OnControllerColliderHit(ControllerColliderHit hit)
 {    
     if (hit.collider.name != "_collision_g_floor")
         Debug.Log( hit.collider.name );
 }

The collision marked in the Debug call is the floor that the character walks on, so I don't display those messages. But just in case that the problem mesh is the floor, I disabled it, and replaced it with a Plane. I can still clearly tell that I'm hitting something, but the script is not saying I'm hitting anything. I can touch a wall, or walk through a door, and I get a message, but when I hit the "invisible line" that bumps my character, no message at all. So according to Unity, I'm not colliding with anything. What is causing the unwanted "collision" then?

This is not the only mesh causing problems. Just that location in the image is the result of the collision mesh. Other locations in the scene have the same issues because of the other collisions, but nothing is reported to the console, so I can't tell whats going on.

avatar image malkere Skeletim · Feb 04, 2017 at 12:17 AM 0
Share

well... not sure. You want me to look at your scene? You can private message me a link.

If you're not getting a collider debug it's probably not an actual collision. Your using a character controller right? Is the height limit... slope limit really low? Is your player using a simple capsule collider?

Show more comments
avatar image Skeletim malkere · Feb 04, 2017 at 09:40 PM 0
Share

Here is a video that better demonstrates what is going on. Note that the character is only moving forward. No other buttons are being pushed.

https://www.youtube.com/watch?v=LqJT-Bcwowo

2 Replies

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

Answer by Skeletim · Feb 05, 2017 at 09:21 PM

It seems like the bottom two meshes that were used as collision had issues computing collision with faces that had the normals facing up. When I deleted those faces, the collision disappeared. And as you can see from the images I posted before, the character controller was not even touching the two bottom meshes. But it was indeed those two meshes. I don't know why the faces had issues. Thanks for the help Malkere

alt text


fix.png (37.4 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
avatar image
0

Answer by malkere · Feb 05, 2017 at 02:07 AM

well.. I fixed it, I'm not totally clear as to why I had to do what I did.... Basically it is your ceiling. alt text

Your ceiling was overlapping in several places with the wall and the second floor. I don't know why your character collider wasn't showing the collisions, but if you increase the size, I made him radius 0.5, height 2, then it was reporting collisions with the ceiling and the wall as well as the floor (make sure you use collapse in the logs). After I removed the overlapping faces, which can't be seen or touched anyway, so shouldn't be there, it works fine.

Somehow the physics engine was having trouble calculating them as exactly the same and there were some arguing collider faces where they were overlapping is all I can guess.


untitled-1.jpg (46.1 kB)
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 Skeletim · Feb 05, 2017 at 02:30 AM 0
Share

What about the back hall? Isn't that also colliding with the bottom collision mesh? Did you see the character collide while walking down the hall?

avatar image Skeletim · Feb 05, 2017 at 07:55 PM 0
Share

I played around with those meshes, and I can remove that mesh altogether and still get the issue. The problem persists until I remove or disable the bottom two meshes that are not even touching the player's character controller. The ceiling was not the problem unfortunately. As having the meshes just the way you have it now, still I get bumped. Its those two meshes I mentioned that when I remove from the scene, the problem goes away. But you can see its not causing any collision from the image. And yes, I did make the corrections that you suggested with no luck. Does anyone understand whats going on?

Could this issue be a bug in the engine with how it deals with collision meshes?

alt text

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

100 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 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 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 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 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

Question on Static Primative vs Mesh Collider Performance 1 Answer

Manual Collision Mesh fails on Static Geometry 1 Answer

Collider not working with dynamic mesh 0 Answers

How do I detect a collision between two colliders? 2 Answers

Correct position of overlapping meshes 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