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
0
Question by Hakumaru · Apr 20, 2014 at 12:50 PM · camerarotationspritemultiplayerlook at

Sprite facing multiple cameras?

Okay, it's a weird question, but say there is an item on the ground, and i'm using a sprite to represent it in a 3D space, i know how to make it face one camera, but what if it's a multiplayer game, is there a way to make it look like it's facing everyones camera no matter where it is, like when one player moves around the object, they say it always facing them, but the other player's version of the object never moves around, it just stays looking at them? If you need me to explain more, feel free to leave your 'what are you talking about?'

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
0

Answer by grahnzz · Apr 20, 2014 at 12:59 PM

Yes this is doable, i cant give you a straightforward implementation though. Take a look here for some reading: [http://www.gamedev.net/topic/358493-vertex-shader-for-screen-aligned-quads/][1]

Edit: found a billboard shader on this wiki: [http://en.wikibooks.org/wiki/Cg_Programming/Unity/Billboards][2]

 Shader "Cg  shader for billboards" {
    Properties {
       _MainTex ("Texture Image", 2D) = "white" {}
    }
    SubShader {
       Pass {   
          CGPROGRAM
  
          #pragma vertex vert  
          #pragma fragment frag 
  
          // User-specified uniforms            
          uniform sampler2D _MainTex;        
  
          struct vertexInput {
             float4 vertex : POSITION;
             float4 tex : TEXCOORD0;
          };
          struct vertexOutput {
             float4 pos : SV_POSITION;
             float4 tex : TEXCOORD0;
          };
  
          vertexOutput vert(vertexInput input) 
          {
             vertexOutput output;
  
             output.pos = mul(UNITY_MATRIX_P, 
               mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
               - float4(input.vertex.x, input.vertex.z, 0.0, 0.0));
  
             output.tex = input.tex;
  
             return output;
          }
  
          float4 frag(vertexOutput input) : COLOR
          {
             return tex2D(_MainTex, float2(input.tex.xy));   
          }
  
          ENDCG
       }
    }
 }

tested it and it and it doesnt work with quad mesh but cube and plane works fine. [1]: http://www.gamedev.net/topic/358493-vertex-shader-for-screen-aligned-quads/ [2]: http://en.wikibooks.org/wiki/Cg_Programming/Unity/Billboards

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

21 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

Related Questions

2D Sprite rotation but still face the camera? 0 Answers

perpendicular sprites towards camera 1 Answer

2D sprites with 3D camera - Change sprite upon rotation - Strange "jitter" 0 Answers

Why LookRotation works, but LookAt doesnt 0 Answers

Problem with the rotation of camera in third person 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