Jump to content
  • Advertisement
Sign in to follow this  
jolteon77

Unity js/unity3d -2d billboarding question

This topic is 1504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all. This video explains better

 

I have a  2d plane sprite in a 3d world. Of course when the cam comes to or is at the left/right of the plane, the plane will seem to disappear. I am trying to get it to rotate at least 30 degrees at that point towards the left/right depending on the cam position, so it will never 'disappear'.

the closest i came to this was in this attempt

  1. var checks : float[];
  2. var myRots : float[];
  3.  
  4. if(Mathf.Clamp(cam.transform.eulerAngles.y, checks[i]-5, checks[i] + 25) == cam.transform.eulerAngles.y)
  5. transform.localEulerAngles.y = transform.parent.transform.rotation.y * myRots[i];
  6.  
  7.  

Here i manually input camera rotations into the checks string, and when the cam rotation is that rotation, i tell the character to rotate itself a specific amount with the 'myRots' string. This only works until the character itself rotates, then the everything i set becomes incorrect. The character is in an empty gameObject. I rotate the parent obj when moving in the world, and rotate the actual plan as needed for the camera. I don't control it with the keys, but it will wander around. Any help is deeply appreaciated!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!