This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using UnityEngine; | |
using Random = UnityEngine.Random; | |
namespace Utils | |
{ | |
public class CameraShake : MonoBehaviour | |
{ | |
[Serializable] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////// | |
//// TRANSPARENT SHADOW COLLECTOR - START //// | |
////////////////////////////////////////////// | |
// See: https://forum.unity.com/threads/transparent-shader-receive-shadows.325877/#post-2114800 | |
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' | |
Shader "Custom/TransparentShadowCollector" | |
{ | |
Properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================= | |
A LIST OF LIVE TEMPLATES FOR UNITY | |
TO MAKE THINGS EASIER, OR JUST BECAUSE, WHY NOT? | |
================================================================== | |
================================================================== | |
UNITY | |
================================================================== | |
------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"com.dbrizov.naughtyattributes": "https://github.com/dbrizov/NaughtyAttributes.git#upm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// catlike coding | |
private Vector3[] Generate(int xSize, ySize) | |
{ | |
Vector3[] vertices = new Vector3[(xSize + 1) * (ySize + 1)]; | |
for (int i = 0, y = 0; y < ySize; y++) | |
{ | |
for (int x = 0; x < xSize; x++, i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Vector3Extensions | |
{ | |
public static Vector3 GetPointOnSphereAngle(this Vector3 center, Vector3 targetDirection, float angle, float radius) | |
{ | |
float angleInRad = Random.Range(0.0f, angle) * Mathf.Deg2Rad; | |
Quaternion dir = Quaternion.LookRotation(targetDirection - center); | |
Vector2 pointOnCircle = (Random.onUnitSphere) * Mathf.Sin(angleInRad); | |
Vector3 pointOnSphere = dir * (new Vector3(pointOnCircle.x, pointOnCircle.y, Mathf.Cos(angleInRad))) + center; | |
Vector3 distFromCenter = (pointOnSphere - center) * radius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://gist.github.com/ashleydavis/f025c03a9221bc840a2b | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using UnityEngine; | |
/// <summary> | |
/// A simple free camera to be added to a Unity game object. |