• 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
Question by StupidlySimple · Aug 06, 2016 at 07:51 PM · unity 5camera2dmeshrendering

Passing Underneath Section of a Mesh

Hi all, I've been trying out submeshes for Tiling with different materials (texture) since it keeps thing nice and clean with just a single GameObject , but I couldn't get the mesh or submeshes to behave like what I wanted when a character passing over certain tiles.

These are the following layout of camera and playable character:

Camera is set at z-level: -10 (default)

Player is set at z-level: 0 (default on creation of gameObject)

Any gameObject that has z-level of -1 would be on top of the player since it closer to the camera relatively speaking while any gameObject that has z-level of 1 should be beneath the player as it further away from the camera.

Since that is the case, I set all ground tiles to be at z-level of 1 while roof tiles should be at -1. While this worked as individually gameObject per layer - that is ground tiles occupied one gameObject with mesh while roof tiles occupied a similar gameObject - it doesn't work when ground and roof tiles occupied the same gameObject via submeshes,

In the combined mesh so the entire tile map uses a single GameObject:

All the vertices of Ground tiles are at z-Level: 1

All the vertices of Roof tiles are at z-Level: -1

There are a lot more ground tiles than roof tiles (obviously).

The player is at z-Level 0, so if I move the player over a roof tiles, the roof tile should render on top of the player. In contrast, the ground should render underneath the player as it further away from the camera. At the moment, they rendered underneath the player, making the player to walk over the roof section of the map ... o_O

It seemed that the Camera doesn't compensate for different z-levels of a single (disjointed) mesh, or that a disjointed mesh has a net-worth/average z-level?

If that is the later case, how do I tell Unity to take into account of dynamic height differences and render them correctly from their position to the camera? Any helps or pointers is greatly appreciated.

Comment

People who like this

0 Show 0
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

0 Replies

· Add your reply
  • Sort: 

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

stencil mesh,stencil mesh-how to i get a stencil mesh to a camra rendering pipe to cull the mesh behand the mesh. dimish the draw call count 0 Answers

Szise is wrong in build 2 Answers

Why do my sprites/textures darken whenever I move my camera? 0 Answers

Plane is not rendered when look up 1 Answer

object not rendered correctly when i take camera away from object in unity vuforia 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