• 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 vainoharha · Dec 18, 2020 at 09:47 PM · collisiontransformprefabsoverlappingglitching

Glitch/overlapping when two objects are on exactly same transform

Is this just a shader problem or something else?

Greetings fellow devs.

I've been struggling with this same problem occasionally when I started using unity.

My current project is using a prefab maze parts (just like in the
Labyrinth board game) and they're instantiated to their certain places
when player presses keyboard button. Works like it should. :)

But when two prefabs (using box colliders,mesh,kinetic rigidbody and
standard shader) are placed to scene problem occurs with some prefabs ->
When two prefabs end to same coordinate they start clipping.
Added a gif to show what i'm typing about.

Gif of my problem in imgurl

This is only happening in play mode. In editor window everything looks good. :P
Problem can be "fixed" by adding -/+0.001 to one of gameobjects current
scale and glitch is gone. But! then there's a small visible edge and i'm
trying to have smooth surface all around the maze.

So is this easily prevented by changing some player settings, setting
custom shaders to prefabs/gameobjects or do I need to micro adjust
and checking every one of them in play mode just like i've been doing to this day?

And here's pic one of prefabs just for kicks:

Picture of one of Prefabs

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

1 Reply

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

Answer by Eno-Khaon · Dec 18, 2020 at 11:23 PM

That is what's known as Z-fighting. It's what happens when floating point accuracy picks a fight with every pixel being rendered, and is a result of stacking multiple triangles on top of each other in that exact manner. It's also pretty commonly seen in 3D games in general.

For the most part, it's not really something that's easily solved except by ensuring that your meshes don't overlap so precisely, by whatever means are necessary. (This could include modifying the models, faking a minute depth change in the vertex shader on an arbitrary per-object basis, etc.)

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 vainoharha · Dec 19, 2020 at 05:00 PM 0
Share

So there's even a name for this phenomenon. Interesting. :)

I'm glad you could give me "Everyday you learn something new" moment.
Well looks like it's going to take a while when fixing and checking every possible prefab combination in working order.

Thank you yet again for precise answer. I'll start my prefab modifying marathon -->

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

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

Is there a solution to when colliders bypass? 2 Answers

Access a prefab from a child class 3 Answers

Make AI run from Player 1 Answer

How to move a Game Object from a script not attached to it. 1 Answer

Moving an object away from collider 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges