Skip to content

Instantly share code, notes, and snippets.

View keyserjaya's full-sized avatar

Nyoman Jaya Temara keyserjaya

  • Miracle Gates Entertainment
  • Denpasar - Bali - Indonesia
  • Instagram keyserjaya
View GitHub Profile
@josephbk117
josephbk117 / Billboard.shader
Last active November 12, 2023 18:13
Advanced Billboard Shader For Unity [ Both Quads & UI ]
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage this stuff is not my responsibility*/
Shader "BitshiftProgrammer/Billboard"
{
Properties
{
_MainTex ("Texture Image", 2D) = "white" {}
_Scaling("Scaling", Float) = 1.0
using UnityEngine;
public class ThisPlatform {
// This property allows you to use ThisPlatform.IsIphoneX to determine if you should do anything special in your code when checking for iPhone X.
public static bool IsIphoneX {
get {
#if UNITY_IOS
// If testing without an iPhone X, add FORCE_IPHONEX to your Scripting Define Symbols.
@kormyen
kormyen / GyroCamera.cs
Last active September 22, 2023 13:37
Unity3D script for rotating camera with a phone's gyro. Includes smoothing and initial offset. Edited from https://forum.unity3d.com/threads/sharing-gyroscope-camera-script-ios-tested.241825/
using UnityEngine;
using System.Collections;
public class GyroCamera : MonoBehaviour
{
// STATE
private float _initialYAngle = 0f;
private float _appliedGyroYAngle = 0f;
private float _calibrationYAngle = 0f;
private Transform _rawGyroRotation;
// UnityからAndroidのCamera LEDを制御する例
// startPreview() でカメラのプレビューを開始した状態で LEDOn() で光る
public class AndroidCamera {
AndroidJavaObject camera = null;
public AndroidCamera() {
WebCamDevice[] devices = WebCamTexture.devices;
Debug.Log("Camera Name:"+devices[0].name);