├── Assembly-CSharp.csproj
├── Assets
├── curvetest.unity
├── curvetest.unity.meta
├── magnetic.mat
├── magnetic.mat.meta
├── magnetic.psd
├── magnetic.psd.meta
├── scripts.meta
└── scripts
│ ├── BezierCurveBase.cs
│ ├── BezierCurveBase.cs.meta
│ ├── CurveMath.cs
│ ├── CurveMath.cs.meta
│ ├── ParticleCurveFollow.cs
│ ├── ParticleCurveFollow.cs.meta
│ ├── ProceduralMeshGenerator.cs
│ ├── ProceduralMeshGenerator.cs.meta
│ ├── VelocityField.cs
│ └── VelocityField.cs.meta
├── Library
├── AnnotationManager
├── AssetImportState
├── AssetServerCacheV3
├── AssetVersioning.db
├── BuildPlayer.prefs
├── BuildSettings.asset
├── CrashedAssetImports.txt
├── CurrentLayout.dwlt
├── EditorUserBuildSettings.asset
├── EditorUserSettings.asset
├── InspectorExpandedItems.asset
├── LastSceneManagerSetup.txt
├── LibraryFormatVersion.txt
├── MonoManager.asset
├── ProjectSettings.asset
├── ScriptAssemblies
│ ├── Assembly-CSharp.dll
│ ├── Assembly-CSharp.dll.mdb
│ └── BuiltinAssemblies.stamp
├── ScriptMapper
├── ShaderCache.db
├── ShaderCache
│ ├── 0
│ │ ├── 02f89a32927e372493766affc92a9650.bin
│ │ ├── 035fdf4e8921567fe413ca009cd0de9a.bin
│ │ ├── 0add4aee2b03a2ee72a360e33ae2f04c.bin
│ │ ├── 0ca71c7a953ef034a54ae1771ad0ca48.bin
│ │ ├── 0cebdaa8e1b0d7b8eaac90140258712e.bin
│ │ └── 0f09c129b5fb5fb7dbc8ef38f314b4ce.bin
│ ├── 1
│ │ ├── 1392c329c93bda04d07a1e7a5830b1db.bin
│ │ └── 1b73ebd3b9abe254fd474e8cf801d8ce.bin
│ ├── 2
│ │ ├── 216e0043421754ee801febf3b5178a29.bin
│ │ ├── 2174e95124e38d2644dd5b93a37c4029.bin
│ │ ├── 255629471755dfeb7853dec68c1c5c58.bin
│ │ ├── 25e53445012d122ab273d0ec7312f752.bin
│ │ └── 2707899eadf27a754c31dda70bba510c.bin
│ ├── 3
│ │ ├── 328f541c86824aec64dabaf86c429ce7.bin
│ │ ├── 39b348d7bdd019c643008aafd798aec9.bin
│ │ ├── 39c01abc4f730637bcdb178c3a929f26.bin
│ │ ├── 3bf334057b6a0e3635b9cc0bcca07f86.bin
│ │ └── 3d42024502b2ff8cf9167f6ff3d9fb54.bin
│ ├── 5
│ │ ├── 598274b839d0fe4c343779124ec05957.bin
│ │ ├── 5f67d3b895613f7207f5b63ae4c09872.bin
│ │ └── 5ff0a8ca9b16002ae9ef31d86fdc82da.bin
│ ├── 6
│ │ ├── 669bd3c37ad979836a0d92021ed4f256.bin
│ │ ├── 66da28ebf34eaff505598c2f386da8d4.bin
│ │ ├── 689a18a23317dbaae9bac32be69b940f.bin
│ │ ├── 6b5c9b88d6844503591fd55cea44310e.bin
│ │ └── 6cd5dac5169bf2792fd67b0a30adf2cd.bin
│ ├── 7
│ │ ├── 747fd799e6613609db17f5347562a53c.bin
│ │ ├── 766fbf8dcc2ca6ab824e443eb85e5472.bin
│ │ ├── 76c4a23084bd8826e07b0347a8583286.bin
│ │ └── 7919cab4f95132dcba7893ddf2eb8592.bin
│ ├── 8
│ │ ├── 80065ab7e411870271bd48d089ccb126.bin
│ │ ├── 888afc9f70e0746370d92c8954a47662.bin
│ │ └── 889e56386f6ab4d10ce0ba122effe73f.bin
│ ├── 9
│ │ ├── 907281ebfba84bc986172cde1c8ee05a.bin
│ │ ├── 913adc93b916ff297db036322457a12f.bin
│ │ ├── 934bdb105cef6b847a0055c294daa64b.bin
│ │ ├── 93f6e3c0fbb395fefa9de1a4ef4c490e.bin
│ │ └── 9cb2876af783233c4f9f2c2a1fe937d2.bin
│ ├── a
│ │ ├── a4efd27551aed33f72c1a4e5a401d559.bin
│ │ ├── abaddc393d76f460be7ce0b02d90f5ba.bin
│ │ ├── ac8403013b3a80c92ffe8b2a5c4aa639.bin
│ │ └── acbb90dc1ceb1a958bdb75c49026cbde.bin
│ ├── b
│ │ ├── b13b89c01cbd191332bb19f59eb86b44.bin
│ │ ├── b330de27afc370b793881fb43bc7e074.bin
│ │ ├── b5ffefe6d4aaa9e5645a9ef1281afb67.bin
│ │ ├── baa872c812f54fe6527eb29295bd6450.bin
│ │ ├── baecc91496e77001600372db4a56a207.bin
│ │ └── bb826b1cb6e6dbfb02c6cf94e2efb8eb.bin
│ ├── c
│ │ ├── c712193623dee90ac64155a06f85306b.bin
│ │ ├── c867928e3cc7f9b524dfd5b3da029090.bin
│ │ ├── ce050ab8f9c73806d4f12d8cfdf9e62f.bin
│ │ └── ce57528a7959c56eaceab659008155f2.bin
│ ├── d
│ │ ├── d00d1deda8c77d7a73e7dd5b8409b81f.bin
│ │ ├── d0c958df2874001c6313772bcbd16d39.bin
│ │ ├── d9480b624a7d41b47f6bcebf3a0ae552.bin
│ │ ├── d993fa899f9038781cb95f5a6fbd885d.bin
│ │ ├── ddc126fcf7a86a1903a04337aedcf9ac.bin
│ │ ├── df1ff6eb5ea72604f5d1a5c2218cea74.bin
│ │ └── dfede76773d15a4f10ff56074ce296d5.bin
│ ├── e
│ │ ├── e0358c2c0a4a7c6b1f99d1f250452376.bin
│ │ ├── eb550a85b35a458f441c1b0839402725.bin
│ │ ├── ed9a30a2db116ab52761a0ddc862f10f.bin
│ │ └── ee4c6cb3107c2350263e9cf4670d2a15.bin
│ └── f
│ │ ├── f36f291d723cfee75d599c09c9a819b9.bin
│ │ └── f7538862ad7d5f24f18c645de2cde5af.bin
├── UnityAssemblies
│ ├── UnityEditor.dll
│ ├── UnityEditor.xml
│ ├── UnityEngine.Advertisements.dll
│ ├── UnityEngine.Advertisements.xml
│ ├── UnityEngine.Analytics.dll
│ ├── UnityEngine.Analytics.xml
│ ├── UnityEngine.HoloLens.dll
│ ├── UnityEngine.HoloLens.xml
│ ├── UnityEngine.Networking.dll
│ ├── UnityEngine.Networking.xml
│ ├── UnityEngine.PlaymodeTestsRunner.dll
│ ├── UnityEngine.PlaymodeTestsRunner.xml
│ ├── UnityEngine.Purchasing.dll
│ ├── UnityEngine.Purchasing.xml
│ ├── UnityEngine.UI.dll
│ ├── UnityEngine.UI.xml
│ ├── UnityEngine.VR.dll
│ ├── UnityEngine.VR.xml
│ ├── UnityEngine.dll
│ ├── UnityEngine.xml
│ └── version.txt
├── assetDatabase3
├── expandedItems
├── metadata
│ ├── 12
│ │ ├── 12fd8a0055b84bb59e84c9835a37e333
│ │ └── 12fd8a0055b84bb59e84c9835a37e333.info
│ ├── 19
│ │ ├── 197afaa9fd9b44430a0499505e098d56
│ │ └── 197afaa9fd9b44430a0499505e098d56.info
│ ├── 21
│ │ ├── 21eff446d50eaf44a85985cd4c0b6fa1
│ │ └── 21eff446d50eaf44a85985cd4c0b6fa1.info
│ ├── 26
│ │ ├── 2682a692a2be7e14e901a738c7806da0
│ │ └── 2682a692a2be7e14e901a738c7806da0.info
│ ├── 30
│ │ ├── 307433eba81a469ab1e2084d52d1a5a2
│ │ └── 307433eba81a469ab1e2084d52d1a5a2.info
│ ├── 38
│ │ ├── 38c8faf1788024c02930a0c68a6e0edc
│ │ └── 38c8faf1788024c02930a0c68a6e0edc.info
│ ├── 41
│ │ ├── 4113173d5e95493ab8765d7b08371de4
│ │ └── 4113173d5e95493ab8765d7b08371de4.info
│ ├── 42
│ │ ├── 422e80b8ba3184d26b4c3b0c2c49a643
│ │ ├── 422e80b8ba3184d26b4c3b0c2c49a643.info
│ │ ├── 4277762b3c154fab9f2e968e868bbbd7
│ │ └── 4277762b3c154fab9f2e968e868bbbd7.info
│ ├── 51
│ │ ├── 517af1b5b81b93b43b9745d58f017562
│ │ └── 517af1b5b81b93b43b9745d58f017562.info
│ ├── 53
│ │ ├── 53ebcfaa2e1e4e2dbc85882cd5a73fa1
│ │ └── 53ebcfaa2e1e4e2dbc85882cd5a73fa1.info
│ ├── 73
│ │ ├── 735426a8d2a3d774e8e6d15b6f62f153
│ │ ├── 735426a8d2a3d774e8e6d15b6f62f153.info
│ │ ├── 739bbd9f364b4268874f9fd86ab3beef
│ │ └── 739bbd9f364b4268874f9fd86ab3beef.info
│ ├── 80
│ │ ├── 80a3616ca19596e4da0f10f14d241e9f
│ │ └── 80a3616ca19596e4da0f10f14d241e9f.info
│ ├── 85
│ │ ├── 852e56802eb941638acbb491814497b0
│ │ └── 852e56802eb941638acbb491814497b0.info
│ ├── 86
│ │ ├── 86f4de9468454445ac2f39e207fafa3a
│ │ └── 86f4de9468454445ac2f39e207fafa3a.info
│ ├── 87
│ │ ├── 870353891bb340e2b2a9c8707e7419ba
│ │ └── 870353891bb340e2b2a9c8707e7419ba.info
│ ├── 90
│ │ ├── 9078b7128e594410d9b89e5b24cffd01
│ │ ├── 9078b7128e594410d9b89e5b24cffd01.info
│ │ ├── 90d4e9b6625db5a42a0a986d3844918a
│ │ └── 90d4e9b6625db5a42a0a986d3844918a.info
│ ├── 97
│ │ ├── 97decbdab0634cdd991f8d23ddf0dead
│ │ └── 97decbdab0634cdd991f8d23ddf0dead.info
│ ├── 00
│ │ ├── 00000000000000001000000000000000
│ │ ├── 00000000000000001000000000000000.info
│ │ ├── 00000000000000002000000000000000
│ │ ├── 00000000000000002000000000000000.info
│ │ ├── 00000000000000003000000000000000
│ │ ├── 00000000000000003000000000000000.info
│ │ ├── 00000000000000004000000000000000
│ │ ├── 00000000000000004000000000000000.info
│ │ ├── 00000000000000004100000000000000
│ │ ├── 00000000000000004100000000000000.info
│ │ ├── 00000000000000005000000000000000
│ │ ├── 00000000000000005000000000000000.info
│ │ ├── 00000000000000005100000000000000
│ │ ├── 00000000000000005100000000000000.info
│ │ ├── 00000000000000006000000000000000
│ │ ├── 00000000000000006000000000000000.info
│ │ ├── 00000000000000006100000000000000
│ │ ├── 00000000000000006100000000000000.info
│ │ ├── 00000000000000007000000000000000
│ │ ├── 00000000000000007000000000000000.info
│ │ ├── 00000000000000007100000000000000
│ │ ├── 00000000000000007100000000000000.info
│ │ ├── 00000000000000008000000000000000
│ │ ├── 00000000000000008000000000000000.info
│ │ ├── 00000000000000009000000000000000
│ │ ├── 00000000000000009000000000000000.info
│ │ ├── 0000000000000000a000000000000000
│ │ ├── 0000000000000000a000000000000000.info
│ │ ├── 0000000000000000a100000000000000
│ │ ├── 0000000000000000a100000000000000.info
│ │ ├── 0000000000000000b000000000000000
│ │ ├── 0000000000000000b000000000000000.info
│ │ ├── 0000000000000000c000000000000000
│ │ └── 0000000000000000c000000000000000.info
│ ├── 0d
│ │ ├── 0d3bb855445e36e479c85976fc88383a
│ │ └── 0d3bb855445e36e479c85976fc88383a.info
│ ├── 1c
│ │ ├── 1c6d1fbb51834b64847b1b73a75bfc77
│ │ └── 1c6d1fbb51834b64847b1b73a75bfc77.info
│ ├── 4b
│ │ ├── 4ba2329b63d54f0187bcaa12486b1b0f
│ │ └── 4ba2329b63d54f0187bcaa12486b1b0f.info
│ ├── 5f
│ │ ├── 5f32cd94baa94578a686d4b9d6b660f7
│ │ └── 5f32cd94baa94578a686d4b9d6b660f7.info
│ ├── 6a
│ │ ├── 6abf4b4cbfd0454e850ffc1ec9140b58
│ │ └── 6abf4b4cbfd0454e850ffc1ec9140b58.info
│ ├── 6c
│ │ ├── 6cdf1e5c78d14720aaadccd4c792df96
│ │ └── 6cdf1e5c78d14720aaadccd4c792df96.info
│ ├── 7e
│ │ ├── 7e04e5eaee9e8864fae9a475363022ef
│ │ └── 7e04e5eaee9e8864fae9a475363022ef.info
│ ├── 8e
│ │ ├── 8e0cd8ed44d4412cbe0642067abc9e44
│ │ ├── 8e0cd8ed44d4412cbe0642067abc9e44.info
│ │ ├── 8e7066e382b0fc749b25dbb1a3004dfe
│ │ └── 8e7066e382b0fc749b25dbb1a3004dfe.info
│ ├── ad
│ │ ├── adebbd281f1a4ef3a30be7f21937e02f
│ │ └── adebbd281f1a4ef3a30be7f21937e02f.info
│ ├── b2
│ │ ├── b2b693dffac3a4433b3114fea0b7fd4e
│ │ ├── b2b693dffac3a4433b3114fea0b7fd4e.info
│ │ ├── b2bead50dbf86924f8e51f03ddbebf70
│ │ └── b2bead50dbf86924f8e51f03ddbebf70.info
│ ├── c0
│ │ ├── c01adef2c4f64cf4298f93633613008b
│ │ └── c01adef2c4f64cf4298f93633613008b.info
│ ├── dc
│ │ ├── dc443db3e92b4983b9738c1131f555cb
│ │ └── dc443db3e92b4983b9738c1131f555cb.info
│ ├── f5
│ │ ├── f5f67c52d1564df4a8936ccd202a3bd8
│ │ └── f5f67c52d1564df4a8936ccd202a3bd8.info
│ ├── f7
│ │ ├── f70555f144d8491a825f0804e09c671c
│ │ ├── f70555f144d8491a825f0804e09c671c.info
│ │ ├── f7b54ff4a43d4fcf81b4538b678e0bcc
│ │ └── f7b54ff4a43d4fcf81b4538b678e0bcc.info
│ ├── fa
│ │ ├── fa09e2de1c298ac499c261179c08488b
│ │ ├── fa09e2de1c298ac499c261179c08488b.info
│ │ ├── faf39a9a5f819ba4f8cdc565a6983a42
│ │ └── faf39a9a5f819ba4f8cdc565a6983a42.info
│ └── fb
│ │ ├── fb4a8f50e62f19548b72254ce83141b9
│ │ └── fb4a8f50e62f19548b72254ce83141b9.info
├── shadercompiler-UnityShaderCompiler.exe0.log
└── shadercompiler-UnityShaderCompiler0.log
├── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── NavMeshAreas.asset
├── NavMeshProjectSettings.asset
├── NetworkManager.asset
├── Physics2DSettings.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── TagManager.asset
├── TimeManager.asset
└── UnityConnectSettings.asset
├── README.md
├── Temp
├── ProcessJobs
│ └── e9a6970f79cd12d8b075e7d72f1b07cb.bakert
├── UnityLockfile
├── UnityTempFile-5b88fd05a444548dc8fd73aca3987a92
└── UnityTempFile-787ff4eac282440ba8410e24169462cd
├── test.csproj
└── test.sln
/Assembly-CSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 |
9 | {E5C00A68-E6DB-FEA3-938C-F34D364EA738}
10 | Library
11 | Properties
12 | Assembly-CSharp
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;UNITY_ANALYTICS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_VR;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | prompt
32 | 4
33 | 0169
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
43 |
44 |
45 | /Applications/Unity/Unity.app/Contents/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll
56 |
57 |
58 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll
59 |
60 |
61 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll
62 |
63 |
64 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TestRunner/nunit.framework.dll
65 |
66 |
67 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll
68 |
69 |
70 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll
71 |
72 |
73 | /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll
74 |
75 |
76 |
77 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/Assets/curvetest.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Assets/curvetest.unity
--------------------------------------------------------------------------------
/Assets/curvetest.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fb4a8f50e62f19548b72254ce83141b9
3 | timeCreated: 1492206528
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/magnetic.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Assets/magnetic.mat
--------------------------------------------------------------------------------
/Assets/magnetic.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 197afaa9fd9b44430a0499505e098d56
3 | timeCreated: 1492297994
4 | licenseType: Free
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/magnetic.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Assets/magnetic.psd
--------------------------------------------------------------------------------
/Assets/magnetic.psd.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 422e80b8ba3184d26b4c3b0c2c49a643
3 | timeCreated: 1492297971
4 | licenseType: Free
5 | TextureImporter:
6 | fileIDToRecycleName: {}
7 | serializedVersion: 4
8 | mipmaps:
9 | mipMapMode: 0
10 | enableMipMap: 1
11 | sRGBTexture: 1
12 | linearTexture: 0
13 | fadeOut: 0
14 | borderMipMap: 0
15 | mipMapFadeDistanceStart: 1
16 | mipMapFadeDistanceEnd: 3
17 | bumpmap:
18 | convertToNormalMap: 0
19 | externalNormalMap: 0
20 | heightScale: 0.25
21 | normalMapFilter: 0
22 | isReadable: 0
23 | grayScaleToAlpha: 0
24 | generateCubemap: 6
25 | cubemapConvolution: 0
26 | seamlessCubemap: 0
27 | textureFormat: 1
28 | maxTextureSize: 2048
29 | textureSettings:
30 | filterMode: -1
31 | aniso: -1
32 | mipBias: -1
33 | wrapMode: -1
34 | nPOTScale: 1
35 | lightmap: 0
36 | compressionQuality: 50
37 | spriteMode: 0
38 | spriteExtrude: 1
39 | spriteMeshType: 1
40 | alignment: 0
41 | spritePivot: {x: 0.5, y: 0.5}
42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
43 | spritePixelsToUnits: 100
44 | alphaUsage: 1
45 | alphaIsTransparency: 0
46 | spriteTessellationDetail: -1
47 | textureType: 0
48 | textureShape: 1
49 | maxTextureSizeSet: 0
50 | compressionQualitySet: 0
51 | textureFormatSet: 0
52 | platformSettings:
53 | - buildTarget: DefaultTexturePlatform
54 | maxTextureSize: 2048
55 | textureFormat: -1
56 | textureCompression: 1
57 | compressionQuality: 50
58 | crunchedCompression: 0
59 | allowsAlphaSplitting: 0
60 | overridden: 0
61 | spriteSheet:
62 | serializedVersion: 2
63 | sprites: []
64 | outline: []
65 | spritePackingTag:
66 | userData:
67 | assetBundleName:
68 | assetBundleVariant:
69 |
--------------------------------------------------------------------------------
/Assets/scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c01adef2c4f64cf4298f93633613008b
3 | folderAsset: yes
4 | timeCreated: 1492204848
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/scripts/BezierCurveBase.cs:
--------------------------------------------------------------------------------
1 | //
2 | // BezierCurveBase - Utilities for creative coding and game with Unity
3 | //
4 | // Copyright (C) 2017 Jae Hyun Yoo
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 | //
24 |
25 | using System.Collections;
26 | using System.Collections.Generic;
27 | using UnityEngine;
28 |
29 | // Description : Using a curve to create velocity field and update particle's velocity/position with it
30 | public class VelocityFieldNode
31 | {
32 | public Vector3 TargetPosition;
33 | public Vector3 TargetVelocity;
34 | public float Mag;
35 | }
36 |
37 | public class BezierCurveBase : MonoBehaviour
38 | {
39 | [Header("Spline Property")]
40 | [Tooltip("How many actual vertices needed to create this curve")]
41 | [Range(5, 100)]
42 | public int Resolution = 24;
43 | [Tooltip("Hide the guide obj when executed")]
44 | bool HideOnExecute = true;
45 |
46 | [Header("Curve Guides")]
47 | public GameObject P0;
48 | public GameObject P1;
49 | public GameObject P0_Tangent;
50 | public GameObject P1_Tangent;
51 |
52 | public Color GizmoColor = new Color(1, 0, 0, 0.25f);
53 | public List VelocityField = new List();
54 | public bool ShowCurve = true;
55 |
56 | protected virtual void Start()
57 | {
58 | SetupGuideComp();
59 |
60 | if (HideOnExecute)
61 | {
62 | DisableTransforms();
63 | }
64 | }
65 |
66 | protected virtual void Update() { }
67 |
68 | void SetupGuideComp()
69 | {
70 | Debug.Log("Generating Helpers");
71 |
72 | if (!P0)
73 | {
74 | P0 = GameObject.CreatePrimitive(PrimitiveType.Cube);
75 | P0.transform.parent = transform;
76 | P0.transform.localPosition = new Vector3(10f, 0f, 0f);
77 | P0.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
78 | P0.name = "P0";
79 | }
80 | if (!P1)
81 | {
82 | P1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
83 | P1.transform.parent = transform;
84 | P1.transform.localPosition = new Vector3(-10f, 0f, 0f);
85 | P1.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
86 | P1.name = "P1";
87 | }
88 | if (!P0_Tangent)
89 | {
90 | P0_Tangent = GameObject.CreatePrimitive(PrimitiveType.Cube);
91 | P0_Tangent.transform.parent = transform;
92 | P0_Tangent.transform.localPosition = new Vector3(10f, 0f, 10f);
93 | P0_Tangent.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
94 | P0_Tangent.name = "P0_Tangent";
95 | P0_Tangent.transform.SetParent(P0.transform);
96 |
97 | }
98 | if (!P1_Tangent)
99 | {
100 | P1_Tangent = GameObject.CreatePrimitive(PrimitiveType.Cube);
101 | P1_Tangent.transform.parent = transform;
102 | P1_Tangent.transform.localPosition = new Vector3(-10f, 0f, -10f);
103 | P1_Tangent.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
104 | P1_Tangent.name = "P1_Tangent";
105 | P1_Tangent.transform.SetParent(P1.transform);
106 | }
107 | }
108 |
109 | public void GetPositionAt(float val, ref Vector3 pos)
110 | {
111 | val = Mathf.Clamp(val, 0.0f, 1.0f);
112 | pos = CurveMath.CalculateBezierPoint(val, P0.transform.position, P0_Tangent.transform.position, P1_Tangent.transform.position, P1.transform.position);
113 | }
114 |
115 | public virtual void OnDestroy()
116 | {
117 | DestroyImmediate(P1_Tangent);
118 | DestroyImmediate(P0_Tangent);
119 | DestroyImmediate(P1);
120 | DestroyImmediate(P0);
121 | }
122 |
123 | public virtual void OnDrawGizmos()
124 | {
125 | if (!ShowCurve || !P0 || !P1 || !P0_Tangent || !P1_Tangent)
126 | return;
127 |
128 | //draw tangents
129 | Gizmos.color = new Color(1, 0, 0, 1.0f);
130 | Gizmos.DrawLine(P0.transform.position, P0_Tangent.transform.position);
131 | Gizmos.color = new Color(1, 0, 0, 1.0f);
132 | Gizmos.DrawLine(P1.transform.position, P1_Tangent.transform.position);
133 |
134 | //draw curve
135 | Vector3 prevPos = P0.transform.position;
136 | for (int c = 1; c <= Resolution; c++)
137 | {
138 | float t = (float)c / Resolution;
139 | Vector3 currPos = CurveMath.CalculateBezierPoint(t, P0.transform.position, P0_Tangent.transform.position, P1_Tangent.transform.position, P1.transform.position);
140 | Vector3 currTan = (currPos - prevPos).normalized;
141 | float mag = (currPos - prevPos).magnitude;
142 |
143 | Gizmos.color = new Color(0, 0, mag, 1);
144 | Gizmos.DrawLine(prevPos, currPos);
145 |
146 | prevPos = currPos;
147 | }
148 | }
149 |
150 | public float Remap(float value, float from1, float to1, float from2, float to2)
151 | {
152 | return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
153 | }
154 |
155 | void DisableTransforms()
156 | {
157 | if (Application.isPlaying)
158 | {
159 | P1_Tangent.SetActive(false);
160 | P0_Tangent.SetActive(false);
161 | P1.SetActive(false);
162 | P0.SetActive(false);
163 | }
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/Assets/scripts/BezierCurveBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7e04e5eaee9e8864fae9a475363022ef
3 | timeCreated: 1492204848
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/scripts/CurveMath.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | static public class CurveMath {
6 |
7 | // create bezier point on specific time t : 0 ~ 1
8 | static public Vector3 CalculateBezierPoint(float t, Vector3 start_pos, Vector3 start_tangent, Vector3 end_tangent, Vector3 end_pos)
9 | {
10 | float u = 1 - t;
11 | float tt = t * t;
12 | float uu = u * u;
13 | float uuu = uu * u;
14 | float ttt = tt * t;
15 |
16 | Vector3 p = uuu * start_pos; //first term
17 | p += 3 * uu * t * start_tangent; //second term
18 | p += 3 * u * tt * end_tangent; //third term
19 | p += ttt * end_pos; //fourth term
20 |
21 | return p;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Assets/scripts/CurveMath.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: faf39a9a5f819ba4f8cdc565a6983a42
3 | timeCreated: 1492207380
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/scripts/ParticleCurveFollow.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Particle Curve Follow - Utilities for creative coding and game with Unity
3 | //
4 | // Copyright (C) 2017 Jae Hyun Yoo
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 | //
24 |
25 | using System.Collections;
26 | using System.Collections.Generic;
27 | using UnityEngine;
28 |
29 | [ExecuteInEditMode]
30 | public class ParticleCurveFollow : MonoBehaviour {
31 |
32 |
33 | [Header("VelocitySource")]
34 | [Tooltip("Use Bezier Curve to drive particle's position and velocity")]
35 | public VelocityField Curve;
36 |
37 | [Header("Particle Control")]
38 | [Tooltip("How fast the particle will move along the curve")]
39 | public float SpeedOnCurve = 1f;
40 | [Tooltip("How fast the particle will move to the curve")]
41 | public float ForceToNearestCurve = 0f;
42 |
43 | private ParticleSystem ParticleSys;
44 | private float SearchRadius = 5f;
45 |
46 | // Use this for initialization
47 | void Start ()
48 | {
49 | ParticleSys = GetComponent();
50 |
51 | if (!ParticleSys)
52 | {
53 | Debug.LogError("There is no ParticleSystem component in this gameObject.");
54 | return;
55 | }
56 |
57 | // set the particle systems that particle surf is using set to simulation space to be world
58 | ParticleSystem.MainModule main = ParticleSys.main;
59 | if (main.simulationSpace != ParticleSystemSimulationSpace.World)
60 | main.simulationSpace = ParticleSystemSimulationSpace.World;
61 |
62 | SetupCurveData();
63 | }
64 |
65 | void Update() {
66 |
67 | if (!ParticleSys)
68 | {
69 | return;
70 | }
71 |
72 | #if UNITY_EDITOR
73 | if (Curve)
74 | {
75 | Curve.CalculateVelocityField();
76 | }
77 | #endif
78 | UpdateParticles();
79 | }
80 |
81 | public void SetupCurveData()
82 | {
83 | if (!Curve)
84 | return;
85 |
86 | SearchRadius = Curve.SearchRadius;
87 | }
88 |
89 | void UpdateParticles()
90 | {
91 | if (!ParticleSys)
92 | return;
93 |
94 | ParticleSystem.Particle[] ParticleList = new ParticleSystem.Particle[ParticleSys.particleCount];
95 | int NumParticleAlive = ParticleSys.GetParticles(ParticleList);
96 | for (int i = 0; i < NumParticleAlive; ++i)
97 | {
98 | ParticleSystem.Particle Particle = ParticleList[i];
99 |
100 | VelocityFieldNode velocityField = new VelocityFieldNode();
101 |
102 | bool IsImported = false;
103 | if (Curve)
104 | {
105 | IsImported = GetTargetNode(Particle, ref Curve.VelocityField, ref velocityField);
106 | }
107 |
108 | if (!IsImported)
109 | continue;
110 |
111 | Vector3 targetVelocity = velocityField.TargetVelocity * SpeedOnCurve * velocityField.Mag;
112 |
113 | // get vector from particle position to curve's iteration pos
114 | Vector3 toCurveVelocity = (velocityField.TargetPosition - Particle.position).normalized;
115 | targetVelocity += toCurveVelocity * ForceToNearestCurve;
116 |
117 | // apply hierarchy scale for velocity as well
118 | targetVelocity.x *= transform.lossyScale.x;
119 | targetVelocity.y *= transform.lossyScale.y;
120 | targetVelocity.z *= transform.lossyScale.z;
121 |
122 | ParticleList[i].position = Particle.position + (targetVelocity * Time.deltaTime);
123 | ParticleList[i].velocity = Particle.velocity;
124 | }
125 | ParticleSys.SetParticles(ParticleList, ParticleSys.particleCount);
126 | }
127 |
128 | private bool GetTargetNode(ParticleSystem.Particle Particle, ref List velocityField, ref VelocityFieldNode targetInfo)
129 | {
130 | float minDist = float.MaxValue;
131 | VelocityFieldNode node = new VelocityFieldNode();
132 | for (int i = 0; i < velocityField.Count; i++)
133 | {
134 | float dist = Vector3.Distance(velocityField[i].TargetPosition, Particle.position);
135 |
136 | if (dist > SearchRadius)
137 | continue;
138 |
139 | if (dist < minDist)
140 | {
141 | minDist = dist;
142 | node = velocityField[i];
143 | }
144 | }
145 |
146 | targetInfo = node;
147 | return true;
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/Assets/scripts/ParticleCurveFollow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 90d4e9b6625db5a42a0a986d3844918a
3 | timeCreated: 1492205101
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/scripts/ProceduralMeshGenerator.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Procedural Mesh Generation - Utilities for creative coding and game with Unity
3 | //
4 | // Copyright (C) 2017 Jae Hyun Yoo
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 | //
24 |
25 | using System.Collections.Generic;
26 | using UnityEngine;
27 |
28 | [ExecuteInEditMode]
29 | public class ProceduralMeshGenerator : BezierCurveBase
30 | {
31 |
32 | public enum OrientEnum { XOriented, YOriented, ZOriented };
33 |
34 | [Header("Create Procedural Mesh")]
35 | public GameObject MeshObj;
36 |
37 | public bool CreateMesh = false;
38 | public bool IsTwoSided = true;
39 | public OrientEnum Orient;
40 | public bool FlipSide = false;
41 | public bool FlipUV = false;
42 | public float CustomCurveMultL = 1.0f;
43 | public float CustomCurveMultR = 1.0f;
44 |
45 | //let's say you edit from inspector, but you can built at runtime if you prefer
46 | public AnimationCurve CurveL = AnimationCurve.Linear(0f, 1f, 1f, 1f); //AnimationCurve.EaseInOut(0f, 0.1f, 1f, 0.9f);
47 |
48 | //let's say you edit from inspector, but you can built at runtime if you prefer
49 | public AnimationCurve CurveR = AnimationCurve.Linear(0f, 1f, 1f, 1f); // AnimationCurve.EaseInOut(0f, 0.1f, 1f, 0.9f);
50 |
51 | private MeshFilter Filter;
52 | private List Vertices = new List();
53 | private List UVs = new List();
54 | private List Triangles = new List();
55 | private Vector3[] CrossVectors = new Vector3[2];
56 | private Mesh ProceduralMesh;
57 |
58 | protected override void Update()
59 | {
60 | base.Update();
61 |
62 | if (CreateMesh)
63 | {
64 | if (!MeshObj)
65 | {
66 | MeshObj = new GameObject();
67 | MeshObj.AddComponent();
68 | MeshObj.AddComponent();
69 | MeshObj.transform.parent = transform;
70 | MeshObj.transform.position = new Vector3(0f, 0f, 0f);
71 | MeshObj.transform.localScale = new Vector3(1f, 1f, 1f);
72 | MeshObj.name = "ProceduralMesh";
73 | Filter = MeshObj.GetComponent();
74 | Filter.sharedMesh = new Mesh();
75 | }
76 | else if (MeshObj && !Filter)
77 | {
78 | Filter = MeshObj.GetComponent();
79 | Filter.sharedMesh = new Mesh();
80 | }
81 |
82 | CreateProceduralMesh();
83 | }
84 | else if (MeshObj && Filter)
85 | {
86 | RemoveProceduralMesh();
87 | }
88 | }
89 |
90 | private void CreateProceduralMesh()
91 | {
92 | Vertices.Clear();
93 | Triangles.Clear();
94 | UVs.Clear();
95 |
96 | Vector3[] pos = new Vector3[Resolution];
97 |
98 | GetCorePoints(ref pos);
99 |
100 | float t;
101 |
102 | float lastId = (float)(pos.Length - 1);
103 | for (int i = 0; i < pos.Length; i++)
104 | {
105 | t = i / (lastId); // 0.0 ~ 1.0
106 | CalculateSideVectors(ref pos, i, CustomCurveMultR * CurveR.Evaluate(t), CustomCurveMultL * CurveL.Evaluate(t));
107 | AddCurvePoint(CrossVectors[1], CrossVectors[0], i, pos.Length - 1);
108 | }
109 |
110 | Mesh mesh = Filter.sharedMesh;
111 | mesh.Clear();
112 |
113 | /*
114 | Vector3[] normales = new Vector3[vertices.Length];
115 | for (int n = 0; n < normales.Length; n++)
116 | normales[n] = Vector3.up;
117 | */
118 |
119 | mesh.vertices = Vertices.ToArray();
120 | //mesh.normals = normales;
121 | mesh.uv = UVs.ToArray();
122 | mesh.triangles = Triangles.ToArray();
123 |
124 | mesh.RecalculateBounds();
125 | //mesh.RecalculateNormals();
126 |
127 | if (MeshObj != null)
128 | {
129 | MeshObj.transform.position = Vector3.zero;
130 | MeshObj.transform.localScale = Vector3.one;
131 | MeshObj.transform.rotation = Quaternion.identity;
132 | }
133 | }
134 |
135 | private void RemoveProceduralMesh()
136 | {
137 | Vertices.Clear();
138 | Triangles.Clear();
139 | UVs.Clear();
140 | Mesh mesh = Filter.sharedMesh;
141 | mesh.Clear();
142 | DestroyImmediate(MeshObj);
143 | }
144 |
145 | private void CalculateSideVectors(ref Vector3[] pos, int i, float WidthR, float WidthL)
146 | {
147 | Vector3 tangent;
148 | if (i + 1 >= pos.Length)
149 | {
150 | tangent = (pos[i] - pos[i - 1]).normalized;
151 | }
152 | else
153 | tangent = (pos[i + 1] - pos[i]).normalized;
154 |
155 | float sign = 1f;
156 | //if (FlipSide)
157 | // sign = -1f;
158 |
159 | Vector3 upvector = new Vector3(sign, pos[i].y, pos[i].z); // XOriented as default
160 | if (Orient == OrientEnum.YOriented)
161 | upvector = new Vector3(pos[i].x, sign, pos[i].z);
162 | else if (Orient == OrientEnum.ZOriented)
163 | upvector = new Vector3(pos[i].x, pos[i].y, sign);
164 |
165 | Vector3 toUpvector = (upvector - pos[i]);
166 |
167 | Vector3 CrossL = Vector3.Cross(tangent, toUpvector).normalized;
168 | Vector3 CrossR = CrossL * -1f;
169 |
170 | Vector3 r = pos[i] + CrossR * WidthR;
171 | Vector3 l = pos[i] + CrossL * WidthL;
172 |
173 | CrossVectors[0] = r;
174 | CrossVectors[1] = l;
175 | }
176 |
177 | private void GetCorePoints(ref Vector3[] pos)
178 | {
179 | Vector3 prevPos = P0.transform.position;
180 | pos[0] = prevPos;
181 | float lastId = (float)(Resolution - 1);
182 | for (int c = 1; c < Resolution; c++)
183 | {
184 | float t = c / lastId;
185 | pos[c] = CurveMath.CalculateBezierPoint(t, P0.transform.position, P0_Tangent.transform.position, P1_Tangent.transform.position, P1.transform.position);
186 | prevPos = pos[c];
187 | }
188 | }
189 |
190 | private void AddCurvePoint(Vector3 R, Vector3 L, int id, int count)
191 | {
192 | int start;
193 |
194 | Vertices.Add(R);
195 | Vertices.Add(L);
196 |
197 | if (FlipUV)
198 | {
199 | UVs.Add(new Vector2(0f, (float)id / count));
200 | UVs.Add(new Vector2(1f, (float)id / count));
201 | }
202 | else
203 | {
204 | UVs.Add(new Vector2((float)id / count, 0f));
205 | UVs.Add(new Vector2((float)id / count, 1f));
206 | }
207 |
208 | if (FlipSide)
209 | {
210 | if (Vertices.Count >= 4)
211 | {
212 | start = Vertices.Count - 4;
213 | Triangles.Add(start + 0);
214 | Triangles.Add(start + 2);
215 | Triangles.Add(start + 1);
216 | Triangles.Add(start + 1);
217 | Triangles.Add(start + 2);
218 | Triangles.Add(start + 3);
219 | // also create side for back so its two sided rendering mesh ,. or use custom shader
220 | if (IsTwoSided)
221 | {
222 | start = Vertices.Count - 4;
223 |
224 | Triangles.Add(start + 0);
225 | Triangles.Add(start + 1);
226 | Triangles.Add(start + 2);
227 | Triangles.Add(start + 1);
228 | Triangles.Add(start + 3);
229 | Triangles.Add(start + 2);
230 | }
231 | }
232 | }
233 | else
234 | {
235 | if (Vertices.Count >= 4)
236 | {
237 | start = Vertices.Count - 4;
238 | Triangles.Add(start + 0);
239 | Triangles.Add(start + 1);
240 | Triangles.Add(start + 2);
241 | Triangles.Add(start + 1);
242 | Triangles.Add(start + 3);
243 | Triangles.Add(start + 2);
244 | // also create side for back so its two sided rendering mesh ,. or use custom shader
245 | if (IsTwoSided)
246 | {
247 | start = Vertices.Count - 4;
248 | Triangles.Add(start + 0);
249 | Triangles.Add(start + 2);
250 | Triangles.Add(start + 1);
251 | Triangles.Add(start + 1);
252 | Triangles.Add(start + 2);
253 | Triangles.Add(start + 3);
254 | }
255 | }
256 | }
257 | }
258 |
259 | public override void OnDestroy()
260 | {
261 | base.OnDestroy();
262 | DestroyImmediate(MeshObj);
263 | }
264 | }
265 |
--------------------------------------------------------------------------------
/Assets/scripts/ProceduralMeshGenerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fa09e2de1c298ac499c261179c08488b
3 | timeCreated: 1492204848
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/scripts/VelocityField.cs:
--------------------------------------------------------------------------------
1 | //
2 | // VelocityField - Utilities for creative coding and game with Unity
3 | //
4 | // Copyright (C) 2017 Jae Hyun Yoo
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 | //
24 |
25 | using UnityEngine;
26 |
27 | [ExecuteInEditMode]
28 | public class VelocityField : BezierCurveBase
29 | {
30 | [Header("Velocity Field")]
31 | [Tooltip("Create Velocity Field")]
32 | public bool CreateVelocityField = true;
33 |
34 | [Tooltip("Update Velocity Field every frame")]
35 | public bool UpdateEveryFrame = false;
36 |
37 | [Tooltip("Visualize the radius that the velocity field will affect")]
38 | public bool ShowSearchRadius = true;
39 |
40 | [Tooltip("Raidus - the size of the radius that the velocity field will affect")]
41 | [Range(0.1f, 100)]
42 | public float SearchRadius = 5f;
43 |
44 | [Tooltip("Map the magnitude of curve velocity")]
45 | public AnimationCurve VelocityMagCurve = AnimationCurve.EaseInOut(0f, 0.8f, 1f, 1.0f);
46 |
47 | public bool Visualize = true;
48 | public float DisplayVelocityLength = 12f;
49 |
50 | protected override void Start()
51 | {
52 | base.Start();
53 |
54 | if (CreateVelocityField)
55 | {
56 | CalculateVelocityField();
57 | }
58 | }
59 |
60 | protected override void Update()
61 | {
62 | base.Update();
63 |
64 | #if UNITY_EDITOR
65 | CalculateVelocityField(); // just run calculating the velocity field everytime we iterate on editor..
66 | #endif
67 | if (UpdateEveryFrame)
68 | {
69 | CalculateVelocityField();
70 | }
71 | }
72 |
73 | public void CalculateVelocityField()
74 | {
75 | VelocityField.Clear();
76 |
77 | Vector3 prevPos = P0.transform.position;
78 | for (int c = 1; c <= Resolution; c++)
79 | {
80 | float t = (float)c / Resolution;
81 | Vector3 currPos = CurveMath.CalculateBezierPoint(t, P0.transform.position, P0_Tangent.transform.position, P1_Tangent.transform.position, P1.transform.position);
82 | Vector3 currTan = (currPos - prevPos).normalized;
83 | float mag = VelocityMagCurve.Evaluate(t);
84 |
85 | VelocityFieldNode ti = new VelocityFieldNode();
86 | ti.TargetPosition = prevPos;
87 | ti.TargetVelocity = currTan;
88 | ti.Mag = mag;
89 | VelocityField.Add(ti);
90 | prevPos = currPos;
91 | }
92 | }
93 |
94 | override public void OnDrawGizmos()
95 | {
96 | base.OnDrawGizmos();
97 |
98 | if (ShowSearchRadius)
99 | {
100 | Gizmos.color = GizmoColor;
101 | Gizmos.DrawWireSphere(P0.transform.position, SearchRadius);
102 | Gizmos.DrawWireSphere(P1.transform.position, SearchRadius);
103 | }
104 |
105 | if (Visualize)
106 | {
107 | #if UNITY_EDITOR
108 | CalculateVelocityField();
109 | #endif
110 | float MaxMag = float.MinValue;
111 | float MinMag = float.MaxValue;
112 |
113 | for (int i = 0; i < VelocityField.Count; i++)
114 | {
115 | if (VelocityField[i].Mag > MaxMag)
116 | {
117 | MaxMag = VelocityField[i].Mag;
118 | }
119 | if (VelocityField[i].Mag < MinMag)
120 | {
121 | MinMag = VelocityField[i].Mag;
122 | }
123 | }
124 |
125 | for (int i = 1; i < VelocityField.Count; i++)
126 | {
127 | float color = Remap(VelocityField[i - 1].Mag, MinMag, MaxMag, 0.05f, 1f);
128 |
129 | Color colorShift = new Color(GizmoColor.r * color, GizmoColor.g * color, GizmoColor.b * color);
130 |
131 | Gizmos.color = colorShift;
132 | Vector3 direction = transform.TransformDirection((VelocityField[i].TargetPosition - VelocityField[i - 1].TargetPosition).normalized) * DisplayVelocityLength;
133 | Gizmos.DrawRay(VelocityField[i - 1].TargetPosition, direction);
134 | }
135 | }
136 | }
137 | }
--------------------------------------------------------------------------------
/Assets/scripts/VelocityField.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 735426a8d2a3d774e8e6d15b6f62f153
3 | timeCreated: 1492204848
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Library/AnnotationManager:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/AnnotationManager
--------------------------------------------------------------------------------
/Library/AssetImportState:
--------------------------------------------------------------------------------
1 | 4;0;196608;0;0
--------------------------------------------------------------------------------
/Library/AssetServerCacheV3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/AssetServerCacheV3
--------------------------------------------------------------------------------
/Library/AssetVersioning.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/AssetVersioning.db
--------------------------------------------------------------------------------
/Library/BuildPlayer.prefs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/BuildPlayer.prefs
--------------------------------------------------------------------------------
/Library/BuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/BuildSettings.asset
--------------------------------------------------------------------------------
/Library/CrashedAssetImports.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/CrashedAssetImports.txt
--------------------------------------------------------------------------------
/Library/EditorUserBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/EditorUserBuildSettings.asset
--------------------------------------------------------------------------------
/Library/EditorUserSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/EditorUserSettings.asset
--------------------------------------------------------------------------------
/Library/InspectorExpandedItems.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/InspectorExpandedItems.asset
--------------------------------------------------------------------------------
/Library/LastSceneManagerSetup.txt:
--------------------------------------------------------------------------------
1 | sceneSetups:
2 | - path: Assets/curvetest.unity
3 | isLoaded: 1
4 | isActive: 1
5 |
--------------------------------------------------------------------------------
/Library/LibraryFormatVersion.txt:
--------------------------------------------------------------------------------
1 | unityRebuildLibraryVersion: 11
2 | unityForwardCompatibleVersion: 40
3 |
--------------------------------------------------------------------------------
/Library/MonoManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/MonoManager.asset
--------------------------------------------------------------------------------
/Library/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ProjectSettings.asset
--------------------------------------------------------------------------------
/Library/ScriptAssemblies/Assembly-CSharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ScriptAssemblies/Assembly-CSharp.dll
--------------------------------------------------------------------------------
/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
--------------------------------------------------------------------------------
/Library/ScriptAssemblies/BuiltinAssemblies.stamp:
--------------------------------------------------------------------------------
1 | 0000.585bcce6.0000
2 | 0000.585bccf0.0000
--------------------------------------------------------------------------------
/Library/ScriptMapper:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ScriptMapper
--------------------------------------------------------------------------------
/Library/ShaderCache.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ShaderCache.db
--------------------------------------------------------------------------------
/Library/ShaderCache/0/02f89a32927e372493766affc92a9650.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ShaderCache/0/02f89a32927e372493766affc92a9650.bin
--------------------------------------------------------------------------------
/Library/ShaderCache/0/035fdf4e8921567fe413ca009cd0de9a.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ShaderCache/0/035fdf4e8921567fe413ca009cd0de9a.bin
--------------------------------------------------------------------------------
/Library/ShaderCache/0/0add4aee2b03a2ee72a360e33ae2f04c.bin:
--------------------------------------------------------------------------------
1 | 2O
SHADOWS_DEPTH
2 | #ifdef VERTEX
3 | #version 150
4 | #extension GL_ARB_explicit_attrib_location : require
5 | #extension GL_ARB_shader_bit_encoding : enable
6 |
7 | uniform vec4 _WorldSpaceLightPos0;
8 | uniform vec4 unity_LightShadowBias;
9 | uniform vec4 hlslcc_mtx4x4unity_ObjectToWorld[4];
10 | uniform vec4 hlslcc_mtx4x4unity_WorldToObject[4];
11 | uniform vec4 hlslcc_mtx4x4unity_MatrixVP[4];
12 | in vec4 in_POSITION0;
13 | in vec3 in_NORMAL0;
14 | vec4 u_xlat0;
15 | vec4 u_xlat1;
16 | vec4 u_xlat2;
17 | float u_xlat6;
18 | float u_xlat9;
19 | bool u_xlatb9;
20 | void main()
21 | {
22 | u_xlat0.x = dot(in_NORMAL0.xyz, hlslcc_mtx4x4unity_WorldToObject[0].xyz);
23 | u_xlat0.y = dot(in_NORMAL0.xyz, hlslcc_mtx4x4unity_WorldToObject[1].xyz);
24 | u_xlat0.z = dot(in_NORMAL0.xyz, hlslcc_mtx4x4unity_WorldToObject[2].xyz);
25 | u_xlat9 = dot(u_xlat0.xyz, u_xlat0.xyz);
26 | u_xlat9 = inversesqrt(u_xlat9);
27 | u_xlat0.xyz = vec3(u_xlat9) * u_xlat0.xyz;
28 | u_xlat1 = in_POSITION0.yyyy * hlslcc_mtx4x4unity_ObjectToWorld[1];
29 | u_xlat1 = hlslcc_mtx4x4unity_ObjectToWorld[0] * in_POSITION0.xxxx + u_xlat1;
30 | u_xlat1 = hlslcc_mtx4x4unity_ObjectToWorld[2] * in_POSITION0.zzzz + u_xlat1;
31 | u_xlat1 = hlslcc_mtx4x4unity_ObjectToWorld[3] * in_POSITION0.wwww + u_xlat1;
32 | u_xlat2.xyz = (-u_xlat1.xyz) * _WorldSpaceLightPos0.www + _WorldSpaceLightPos0.xyz;
33 | u_xlat9 = dot(u_xlat2.xyz, u_xlat2.xyz);
34 | u_xlat9 = inversesqrt(u_xlat9);
35 | u_xlat2.xyz = vec3(u_xlat9) * u_xlat2.xyz;
36 | u_xlat9 = dot(u_xlat0.xyz, u_xlat2.xyz);
37 | u_xlat9 = (-u_xlat9) * u_xlat9 + 1.0;
38 | u_xlat9 = sqrt(u_xlat9);
39 | u_xlat9 = u_xlat9 * unity_LightShadowBias.z;
40 | u_xlat0.xyz = (-u_xlat0.xyz) * vec3(u_xlat9) + u_xlat1.xyz;
41 | u_xlatb9 = unity_LightShadowBias.z!=0.0;
42 | u_xlat0.xyz = (bool(u_xlatb9)) ? u_xlat0.xyz : u_xlat1.xyz;
43 | u_xlat2 = u_xlat0.yyyy * hlslcc_mtx4x4unity_MatrixVP[1];
44 | u_xlat2 = hlslcc_mtx4x4unity_MatrixVP[0] * u_xlat0.xxxx + u_xlat2;
45 | u_xlat0 = hlslcc_mtx4x4unity_MatrixVP[2] * u_xlat0.zzzz + u_xlat2;
46 | u_xlat0 = hlslcc_mtx4x4unity_MatrixVP[3] * u_xlat1.wwww + u_xlat0;
47 | u_xlat1.x = unity_LightShadowBias.x / u_xlat0.w;
48 | u_xlat1.x = clamp(u_xlat1.x, 0.0, 1.0);
49 | u_xlat6 = u_xlat0.z + u_xlat1.x;
50 | u_xlat1.x = max((-u_xlat0.w), u_xlat6);
51 | gl_Position.xyw = u_xlat0.xyw;
52 | u_xlat0.x = (-u_xlat6) + u_xlat1.x;
53 | gl_Position.z = unity_LightShadowBias.y * u_xlat0.x + u_xlat6;
54 | return;
55 | }
56 |
57 | #endif
58 | #ifdef FRAGMENT
59 | #version 150
60 | #extension GL_ARB_explicit_attrib_location : require
61 | #extension GL_ARB_shader_bit_encoding : enable
62 |
63 | layout(location = 0) out vec4 SV_Target0;
64 | void main()
65 | {
66 | SV_Target0 = vec4(0.0, 0.0, 0.0, 0.0);
67 | return;
68 | }
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/Library/ShaderCache/0/0ca71c7a953ef034a54ae1771ad0ca48.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ShaderCache/0/0ca71c7a953ef034a54ae1771ad0ca48.bin
--------------------------------------------------------------------------------
/Library/ShaderCache/0/0cebdaa8e1b0d7b8eaac90140258712e.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkkcloud/UnityParticleCurveFollow/fc209eff95b9a5e1a22eb0d560fbcb77ad2faa11/Library/ShaderCache/0/0cebdaa8e1b0d7b8eaac90140258712e.bin
--------------------------------------------------------------------------------
/Library/ShaderCache/0/0f09c129b5fb5fb7dbc8ef38f314b4ce.bin:
--------------------------------------------------------------------------------
1 | 2O SHADOWS_SPLIT_SPHERES 8&