This file contains hidden or 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
IEnumerator Interpolate(float3 p0, float3 p1) { | |
var maxProgress = 0f; | |
var segmentDelta = p1 - p0; | |
var len = math.distance(p1, p0); | |
var fwDelta = fwDeltaLen / len; | |
var segmentDir = math.normalize(segmentDelta); | |
while (true) { | |
float3 position = transform.position; | |
var progress = fwDelta + math.dot(position - p0, segmentDir) / len; | |
progress = math.clamp(progress, 0f, 1f); |
This file contains hidden or 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
void BuildGizmos() { | |
var occupiedComb = new List<CombineInstance>(); | |
var freeComb = new List<CombineInstance>(); | |
int xLen = _runtimeGrid.Len0, yLen = _runtimeGrid.Len1, zLen = _runtimeGrid.Len2; | |
var sharedMesh = Cube(); | |
sharedMesh.hideFlags = HideFlags.DontSave; | |
for (var x = 0; x < xLen; x++) | |
for (var y = 0; y < yLen; y++) | |
for (var z = 0; z < zLen; z++) { |
This file contains hidden or 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.Generic; | |
using System.IO; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
namespace AssetUsageFinder { | |
public class CacheManager { | |
Dictionary<string, AssetDependencies> _dict; |
This file contains hidden or 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
static class DirtyUtils { | |
static bool Same<T1, T2>(ref int hash, in T1 v1, in T2 v2) { | |
var prev = hash; | |
hash = v1.GetHashCode(); | |
hash = (hash * 397) ^ v2.GetHashCode(); | |
return hash == prev; | |
} | |
public static int HashCode<T1, T2>(in T1 v1, in T2 v2) { | |
var hash = v1.GetHashCode(); |
This file contains hidden or 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
IEnumerable<AnimatorState> Traverse(AnimatorController controller) { | |
foreach (var controllerLayer in controller.layers) | |
foreach (var st in Inner(controllerLayer.stateMachine)) | |
yield return st; | |
IEnumerable<AnimatorState> Inner(AnimatorStateMachine f) { | |
foreach (var state in f.states) | |
yield return state.state; | |
foreach (var child in f.stateMachines) |
This file contains hidden or 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 BezierSegment TryGetNextSegment() { | |
if (IsInValidChain == false) | |
return null; | |
var thisIndex = transform.GetSiblingIndex(); | |
var isLast = thisIndex == transform.parent.childCount - 1; | |
BezierSegment GetSiblingSegment(int i) => transform.parent.GetChild(i).GetComponent<BezierSegment>(); | |
if (isLast && BezierChain.loop) | |
return GetSiblingSegment(0); // First segment | |
return isLast ? null : GetSiblingSegment(thisIndex + 1); | |
} |
This file contains hidden or 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
[InitializeOnLoad] | |
public static class BoneRendererUtil { | |
class BatchRenderer { | |
const int KMaxDrawMeshInstanceCount = 1023; | |
public enum SubMeshType { | |
BoneFaces, | |
BoneWire, | |
Count | |
} |
This file contains hidden or 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
Shader "Hidden/BoneHandles" | |
{ | |
Properties | |
{ | |
_Color ("Color", Color) = (1,1,1,1) | |
} | |
SubShader | |
{ | |
Tags { "Queue" = "Transparent" "RenderType"="Transparent" "ForceSupported" = "True" } |
This file contains hidden or 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
{ | |
"name": "if_false", | |
"references": [], | |
"includePlatforms": [], | |
"excludePlatforms": [], | |
"allowUnsafeCode": false, | |
"overrideReferences": false, | |
"precompiledReferences": [], | |
"autoReferenced": true, | |
"defineConstraints": [ |