Skip to content

Instantly share code, notes, and snippets.

@keijiro
Created December 18, 2017 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keijiro/cac2a218833805d04e159587898fe097 to your computer and use it in GitHub Desktop.
Save keijiro/cac2a218833805d04e159587898fe097 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class SetRotation : MonoBehaviour { public Material material; public void Set(Vector3 r) { var q = Quaternion.Euler(r.x, r.y, r.z); var m = Matrix4x4.TRS(Vector3.zero, q, Vector3.one); material.SetVector("_Rotation1", m.GetRow(0)); material.SetVector("_Rotation2", m.GetRow(1)); material.SetVector("_Rotation3", m.GetRow(2)); } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment