Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 CrispyLovesYou · Jan 28, 2013 at 01:44 AM · spriteclipping

Sprite clips into 3D environment; any way to render the sprite?

I'm using 2D sprites in a 3D environment, but I'm having problems with the sprites clipping into the 3D walls. I have a script on the sprites that makes them rotate to "face" the camera as it orbits vertically. However, the 3D walls do not rotate, and therefore the sprites will sometimes clip into the walls.

Here's an example of this:

alt text

Is there any elegant solution to have the sprites render fully, even if they're clipping through something? Or if not, is there any other solution that can solve this dilemma? I can't just have a separate ortho camera render the sprites because then they wouldn't appear "behind" the walls, either.

Comment
Add comment · Show 4
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 Jessy · Jan 28, 2013 at 03:46 AM 0
Share

Don't use a script. Billboarding should be done in the shader.

avatar image CrispyLovesYou · Jan 28, 2013 at 03:56 AM 0
Share

You are amazing. Thank you! (Such a "duh" solution, too.)

avatar image CrispyLovesYou · Jan 28, 2013 at 06:56 AM 0
Share

I just tried using a CG shader ins$$anonymous$$d... but to no avail. The result is exactly the same: the sprite clips through the wall.

avatar image Sanky · Jan 28, 2013 at 11:53 AM 0
Share

this script help you to animate shader

 function LateUpdate ()
 {
 myTransform.LookAt(target);
 }
 function Awake ()
 {
 var myTransform = transform; //cache the transform
 var target = Camera.main.transform; //cace the transform of the camera
 }

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by antiReady · Feb 21, 2014 at 10:37 AM

I'm working on something similar (even using the same RO test sprite haha). To fix this, I fixed the sprites Y axis and scaled it (taking camera angle into account) instead of rotating it on all axis.

Here is a crappy drawing to visualize what I mean (side view)alt text

To the camera it looks exactly the same but it solves the clipping problem quite nicely

Hope it helps :)


rotatescale.jpg (64.5 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

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

12 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

Related Questions

How do I prevent my 2D Sprite from clipping into my 3D Environment 0 Answers

2D sprites in a 3D environment - undistorted without clipping 0 Answers

Can I use clipping with Unity Sprite in NGUI? 0 Answers

How to change the textureRect of a Sprite with a dynamic way? 0 Answers

Create a Sprite Animation Clip in Code 3 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