Skip to content

Instantly share code, notes, and snippets.

Last active April 26, 2023 16:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Hamcha/6096910 to your computer and use it in GitHub Desktop.
Stupid Unity scripts: 2D Billboards with perspective camera.
using UnityEngine;
using System.Collections;
public class Sprite2D : MonoBehaviour {
public Camera gameCamera;
private float initialRotation;
void Start()
initialRotation = transform.rotation.z;
void Update()
transform.rotation = gameCamera.transform.rotation;
transform.Rotate(Vector3.up * initialRotation * 180); // Fix Rotation (Flipped sprites)
Copy link

im slowly trying to fix the camera for my game, this fixed a rotation bug i had, thx!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment