Initial commit

This commit is contained in:
Josh4359
2023-09-16 18:53:33 -07:00
commit 23aa1fb180
35 changed files with 2160 additions and 0 deletions

21
Samples/README.txt Normal file
View File

@ -0,0 +1,21 @@
In the Spline Debug scene, there are 6 important objects:
1. Spline
- A curved spline going from (0, 0, 0) to (10, 0, -5)
2. Deform
- A curved spline used to deform Spline
3. Spline Plus
- An object with the SplinePlus component
- This object is used to deform spline Spline along spline Deform
- The resulting spline is rendered in green with Gizmos enabled
4. Evaluate
- Renders a cube gizmo along each of the above splines at a given distance from a given anchor point
5. Nearest Point
- Renders a cube gizmo at the nearest point along the deformed spline from the Spline Plus object
6. Spline Debug
- An instantiated Blender file including a tube warped around the deformed spline using Blender's Curve modifier

7
Samples/README.txt.meta Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4f23fad103e2d8548be04a5c255ce66b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Samples/Spline Debug.blend Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: b93c3e7374b43344ca6fa176d935f2bd
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Samples/Spline Debug.blend1 Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d3d151e577ee0984bbf49dac54834606
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1020
Samples/Spline Debug.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 44ea138cdbdb30745b195f3459bdf8c9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,48 @@
using Unity.Mathematics;
using UnityEngine;
public class SplineEvaluateDebug : MonoBehaviour
{
[SerializeField] SplinePlus splinePlus;
[SerializeField] float anchor;
[SerializeField] float distance;
[SerializeField] float cubeSize;
[SerializeField] float matrixSize;
void OnDrawGizmos()
{
if (!splinePlus) return;
splinePlus.Evaluate(anchor, distance, out Vector3 position, out Quaternion rotation);
transform.position = position;
transform.rotation = rotation;
Gizmos.DrawCube(position, Vector3.one * cubeSize);
splinePlus.splineContainer.Evaluate(anchor + (distance / splinePlus.splineContainer.Spline.GetLength()), out float3 position1, out _, out _);
Gizmos.DrawCube(position1, Vector3.one * cubeSize);
splinePlus.deformContainer.Evaluate(position1.x / splinePlus.deformContainer.Spline.GetLength(), out float3 deformPosition, out _, out _);
Gizmos.DrawCube(deformPosition, Vector3.one * cubeSize);
Gizmos.color = Color.green;
Gizmos.DrawRay(position, transform.up * matrixSize);
Gizmos.color = Color.red;
Gizmos.DrawRay(position, transform.right * matrixSize);
Gizmos.color = Color.blue;
Gizmos.DrawRay(position, transform.forward * matrixSize);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b96504a617d74094faa656840a73e7a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
using UnityEngine;
public class SplineNearestPointDebug : MonoBehaviour
{
[SerializeField] SplinePlus splinePlus;
[SerializeField] float cubeSize;
void OnDrawGizmos()
{
if (!splinePlus) return;
splinePlus.GetNearestPoint(transform.position, out Vector3 position, out _);
Gizmos.DrawCube(position, Vector3.one * cubeSize);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0760258fbb4f0b5418d9a88014403d0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/Splines.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8b9cd3cbddbe4e44abf819fdd6da81ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
{
"splines": [
{
"controlPoints": [
{
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"handleL": {
"x": -9.999999046325684,
"y": -1.5099578831723193e-06,
"z": 0.0
},
"handleR": {
"x": 9.999999046325684,
"y": 1.5099578831723193e-06,
"z": 0.0
},
"tilt": 0.0
},
{
"position": {
"x": 10.000001907348633,
"y": -9.999998092651367,
"z": 0.0
},
"handleL": {
"x": 1.9073486328125e-06,
"y": -10.000001907348633,
"z": 0.0
},
"handleR": {
"x": 20.000001907348633,
"y": -9.999994277954102,
"z": 0.0
},
"tilt": 0.0
}
],
"closed": false
}
]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 22decb6838ce8a34a883a7ad6c7c3335
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
{
"splines": [
{
"controlPoints": [
{
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"handleL": {
"x": -1.0,
"y": -8.742277657347586e-08,
"z": 0.0
},
"handleR": {
"x": 1.0,
"y": 8.742277657347586e-08,
"z": 0.0
},
"tilt": -0.0
},
{
"position": {
"x": 10.0,
"y": -5.0,
"z": 0.0
},
"handleL": {
"x": 9.0,
"y": -5.0,
"z": 0.0
},
"handleR": {
"x": 11.0,
"y": -5.0,
"z": 0.0
},
"tilt": -0.0
}
],
"closed": false
}
]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f3719dd04e0fe40438bb9578e9d53804
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: