├── Packages └── manifest.json ├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── AudioManager.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── TimeManager.asset ├── DynamicsManager.asset ├── EditorSettings.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── GraphicsSettings.asset ├── Physics2DSettings.asset ├── UnityAdsSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset └── UnityConnectSettings.asset ├── screen.png ├── UnityPackageManager └── manifest.json ├── Assets ├── BezierPath │ ├── prefab │ │ ├── end.mat │ │ ├── pivot.mat │ │ ├── Bezier.prefab │ │ ├── Bezier.prefab.meta │ │ ├── end.mat.meta │ │ └── pivot.mat.meta │ ├── sample │ │ ├── pathTest.unity │ │ ├── pathTest_distance.unity │ │ ├── BezierPathTimeline.playable │ │ ├── pathTest_useTimeline.unity │ │ ├── pathTest.unity.meta │ │ ├── pathTest_distance.unity.meta │ │ ├── pathTest_useTimeline.unity.meta │ │ ├── BezierPathTimeline.playable.meta │ │ ├── LookAtTarget.cs.meta │ │ ├── ProtByDistance.cs.meta │ │ ├── TimelineController.cs.meta │ │ ├── ProtByDistance.cs │ │ ├── LookAtTarget.cs │ │ └── TimelineController.cs │ ├── Editor.meta │ ├── prefab.meta │ ├── sample.meta │ ├── BezierPt.cs.meta │ ├── BezierPath.cs.meta │ ├── Editor │ │ ├── BezierLayoutEditorWindow.cs.meta │ │ └── BezierLayoutEditorWindow.cs │ ├── BezierPathTimeline.cs.meta │ ├── BezierPathDrawer.cs.meta │ ├── BezierPathTimeline.cs │ ├── BezierPt.cs │ ├── BezierPathDrawer.cs │ └── BezierPath.cs └── BezierPath.meta ├── README.md └── .gitignore /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.2.0p4 2 | -------------------------------------------------------------------------------- /screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/screen.png -------------------------------------------------------------------------------- /UnityPackageManager/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/end.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/prefab/end.mat -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/pivot.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/prefab/pivot.mat -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/Bezier.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/prefab/Bezier.prefab -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/sample/pathTest.unity -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest_distance.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/sample/pathTest_distance.unity -------------------------------------------------------------------------------- /Assets/BezierPath/sample/BezierPathTimeline.playable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/sample/BezierPathTimeline.playable -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest_useTimeline.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inoook/BezierPath/HEAD/Assets/BezierPath/sample/pathTest_useTimeline.unity -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49b3517222cdf4116970c77b6716835b 3 | timeCreated: 1448619286 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/Bezier.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52149ca39e4dc4184a00f8cd89262a85 3 | timeCreated: 1448887332 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BezierPath.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 552608a0b80a140f59471adebb550d28 3 | folderAsset: yes 4 | timeCreated: 1448969707 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest_distance.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdf2528c063e54511bd2ac6ffbe5bdb8 3 | timeCreated: 1448619286 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/pathTest_useTimeline.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1c6604cf9435420caf11c8b46732bc1 3 | timeCreated: 1448619286 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BezierPath/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fd8c46e0dab64d7f8567f20159cf37c 3 | folderAsset: yes 4 | timeCreated: 1496378686 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/BezierPath/prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb6756e43c2ba4c96886f9087c09050a 3 | folderAsset: yes 4 | timeCreated: 1520589727 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d5f52aee86f649e58b8dac2c4092cd0 3 | folderAsset: yes 4 | timeCreated: 1520586652 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/end.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 595b83e1e2d4041edb9da592a225e8c6 3 | timeCreated: 1520589743 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BezierPath/prefab/pivot.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3e122bac4a7048409db454a475d4b27 3 | timeCreated: 1520589743 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/BezierPathTimeline.playable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e758a5cee051042c3b7a210ef0a1d145 3 | timeCreated: 1520580010 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPt.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaa392b0b4f61448aaed48ca36b9bf68 3 | timeCreated: 1448887843 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/BezierPath/BezierPath.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da29f431934a547e29da1f78729a9458 3 | timeCreated: 1448902272 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/BezierPath/Editor/BezierLayoutEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 130dbc8bc73754e3fb487090e4ec1791 3 | timeCreated: 1459311624 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPathTimeline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31144160642634818961883f7cf1de78 3 | timeCreated: 1520579532 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/LookAtTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1fa321f5e3ae48c4bd72b80e3650043 3 | timeCreated: 1520586073 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/ProtByDistance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f399876a73b40416083325e1d63f365a 3 | timeCreated: 1541493587 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/TimelineController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63c806ad848094aa39592bf3b71413b3 3 | timeCreated: 1520586868 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BezierPath 2 | BezierPath for unity 3 | 4 | ![Sample](screen.png) 5 | 6 | ~~~cs 7 | BezierPath path = new BezierPath (nodes, rots); 8 | 9 | // v: 0 - 1 10 | BezierPointInfo pInfo = path.GetBezierPointInfo(v); 11 | 12 | /// 13 | /// Bezier point info. 14 | /// 15 | public class BezierPointInfo 16 | { 17 | public Vector3 point; 18 | public Quaternion rotation; 19 | public Vector3 tangent; 20 | } 21 | ~~~ 22 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPathDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4455577ba14f4fa19d2e4600d6db022 3 | timeCreated: 1520585889 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: 9 | - pointPrefab: {fileID: 11464362, guid: 52149ca39e4dc4184a00f8cd89262a85, type: 2} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | *.VC.db 27 | 28 | # Unity3D generated meta files 29 | *.pidb.meta 30 | *.pdb.meta 31 | 32 | # Unity3D Generated File On Crash Reports 33 | sysinfo.txt 34 | 35 | # Builds 36 | *.apk 37 | *.unitypackage 38 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/ProtByDistance.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using Bezier; 6 | 7 | public class ProtByDistance : MonoBehaviour { 8 | 9 | [SerializeField] BezierPathDrawer bezierPathDrawer; 10 | [SerializeField] float dist; 11 | 12 | // Use this for initialization 13 | void Start () { 14 | 15 | } 16 | 17 | // Update is called once per frame 18 | void Update () { 19 | float ratio = dist / bezierPathDrawer.length; 20 | BezierPointInfo info = bezierPathDrawer.GetBezierPointInfo(ratio); 21 | 22 | //this.transform.position = info.point; 23 | //this.transform.rotation = info.rotation; 24 | 25 | info.point = bezierPathDrawer.transform.TransformPoint(info.point); 26 | info.rotation = bezierPathDrawer.transform.rotation * (info.rotation); 27 | this.transform.position = info.point; 28 | this.transform.rotation = info.rotation; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/LookAtTarget.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [ExecuteInEditMode] 6 | public class LookAtTarget : MonoBehaviour { 7 | 8 | [SerializeField] Transform targetTrans; 9 | 10 | // Use this for initialization 11 | void Start () { 12 | 13 | } 14 | 15 | // Update is called once per frame 16 | void LateUpdate () { 17 | this.transform.LookAt (targetTrans); 18 | } 19 | 20 | [SerializeField] bool isDrawGizmos = false; 21 | [SerializeField] Color color = Color.red; 22 | [SerializeField] float arrowSize = 1.0f; 23 | 24 | void OnDrawGizmos () 25 | { 26 | if(!isDrawGizmos){ return; } 27 | 28 | Gizmos.color = color; 29 | Gizmos.DrawLine (this.transform.position, targetTrans.position); 30 | 31 | DrawArrow (targetTrans.position, arrowSize); 32 | } 33 | 34 | void DrawArrow(Vector3 pos, float size) 35 | { 36 | Gizmos.DrawLine (pos, pos + this.transform.rotation * (new Vector3(0.5f, 0, -1) * size)); 37 | Gizmos.DrawLine (pos, pos + this.transform.rotation * (new Vector3(-0.5f, 0, -1) * size)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPathTimeline.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using Bezier; 6 | 7 | [ExecuteInEditMode] 8 | public class BezierPathTimeline : MonoBehaviour { 9 | 10 | Transform target; 11 | [SerializeField] BezierPathDrawer bezierPathDrawer; 12 | 13 | [Range(0, 1)] 14 | public float ratio = 0; 15 | 16 | [SerializeField] bool rotate = true; 17 | 18 | BezierPath path; 19 | 20 | // Use this for initialization 21 | void Start () { 22 | target = this.transform; 23 | 24 | if (bezierPathDrawer != null) { 25 | path = bezierPathDrawer.GetBezierPath (); 26 | } 27 | } 28 | 29 | // Update is called once per frame 30 | void Update () { 31 | if (target == null) { 32 | target = this.transform; 33 | } 34 | 35 | if (bezierPathDrawer != null && Application.isEditor && !Application.isPlaying) { 36 | path = bezierPathDrawer.path; 37 | } 38 | if (bezierPathDrawer == null || path == null || target == null) { 39 | return; 40 | } 41 | // update 42 | BezierPointInfo info = path.GetBezierPointInfo (ratio); 43 | target.transform.position = info.point; 44 | if (rotate) { 45 | target.transform.rotation = info.rotation; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/BezierPath/sample/TimelineController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Playables; 5 | 6 | using UnityEditor; 7 | 8 | 9 | public class TimelineController : MonoBehaviour { 10 | 11 | [SerializeField] 12 | PlayableDirector playableDirector; 13 | 14 | // Use this for initialization 15 | void Start () { 16 | 17 | } 18 | 19 | // Update is called once per frame 20 | void Update () { 21 | 22 | } 23 | 24 | void PlayTimeline() 25 | { 26 | playableDirector.Play (); 27 | } 28 | void StopTimeline() 29 | { 30 | playableDirector.Stop (); 31 | } 32 | void PauseTimeline() 33 | { 34 | playableDirector.Pause (); 35 | } 36 | void ResumeTimeline() 37 | { 38 | playableDirector.Resume (); 39 | } 40 | 41 | [SerializeField] Rect drawRect = new Rect (10,10,100,100); 42 | [SerializeField] GUISkin skin; 43 | void OnGUI() 44 | { 45 | GUI.skin = skin; 46 | GUILayout.BeginArea (drawRect); 47 | GUILayout.Label ( ((float)(playableDirector.time / playableDirector.duration)).ToString() ); 48 | GUILayout.Label ("time: "+playableDirector.time); 49 | playableDirector.time = GUILayout.HorizontalSlider ((float)playableDirector.time, 0, (float)playableDirector.duration); 50 | 51 | // if (GUILayout.Button ("PlayTimeline")) { 52 | // PlayTimeline (); 53 | // } 54 | // if (GUILayout.Button ("PauseTimeline")) { 55 | // PauseTimeline (); 56 | // } 57 | // if (GUILayout.Button ("ResumeTimeline")) { 58 | // ResumeTimeline (); 59 | // } 60 | // if (GUILayout.Button ("StopTimeline")) { 61 | // StopTimeline (); 62 | // } 63 | GUILayout.EndArea (); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPt.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class BezierPt : MonoBehaviour { 5 | 6 | [HideInInspector] public Transform inTrans; 7 | [HideInInspector] public Transform outTrans; 8 | 9 | [HideInInspector, SerializeField] Transform pivot; 10 | 11 | // Use this for initialization 12 | void Start () { 13 | 14 | } 15 | 16 | // Update is called once per frame 17 | void Update () { 18 | 19 | } 20 | 21 | void OnDrawGizmos () { 22 | pivot.hideFlags = HideFlags.HideInHierarchy; 23 | pivot.localPosition = Vector3.zero; 24 | 25 | Gizmos.color = Color.red; 26 | Gizmos.DrawLine(this.transform.position, inTrans.position); 27 | Gizmos.DrawLine(this.transform.position, outTrans.position); 28 | 29 | // 30 | Vector3 pt = this.transform.position; 31 | Quaternion quat = this.transform.rotation; 32 | Gizmos.color = Color.blue; 33 | Gizmos.DrawRay(pt, quat * Vector3.forward); 34 | Gizmos.color = Color.green; 35 | Gizmos.DrawRay(pt, quat * Vector3.up); 36 | Gizmos.color = Color.red; 37 | Gizmos.DrawRay(pt, quat * Vector3.right); 38 | 39 | if (transform.hasChanged || inTrans.hasChanged || outTrans.hasChanged || pivot.hasChanged) 40 | { 41 | isTransformChange = true; 42 | transform.hasChanged = false; 43 | inTrans.hasChanged = false; 44 | outTrans.hasChanged = false; 45 | pivot.hasChanged = false; 46 | }else{ 47 | isTransformChange = false; 48 | } 49 | } 50 | 51 | [HideInInspector] public bool isTransformChange = false; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Assets/BezierPath/Editor/BezierLayoutEditorWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEditor; 5 | using Bezier; 6 | 7 | public class BezierLayoutEditorWindow : EditorWindow { 8 | 9 | // Add menu named "My Window" to the Window menu 10 | [MenuItem ("Course/BezierLayout Create")] 11 | static void Init () { 12 | // Get existing open window or if none, make a new one: 13 | BezierLayoutEditorWindow window = (BezierLayoutEditorWindow)EditorWindow.GetWindow (typeof (BezierLayoutEditorWindow)); 14 | window.Show(); 15 | } 16 | 17 | BezierPathDrawer bezierPathDrawer; 18 | GameObject hoopPrefab; 19 | GameObject hoopCourse; 20 | 21 | void OnGUI () { 22 | GUILayout.Label ("Bezier Prot", EditorStyles.boldLabel); 23 | GUILayout.Label ("作成したいGameObjectを選択して、Createボタンを押す。"); 24 | GUILayout.Label ("bezierPathDrawerにそってレイアウトする。"); 25 | 26 | bezierPathDrawer = (BezierPathDrawer)EditorGUILayout.ObjectField("bezierPathDrawer", bezierPathDrawer, typeof(BezierPathDrawer), true); 27 | hoopPrefab = (GameObject)EditorGUILayout.ObjectField("prefab", hoopPrefab, typeof(GameObject), false); 28 | 29 | distance = EditorGUILayout.FloatField("layoutDistance", distance); 30 | 31 | GameObject createTarget = Selection.activeGameObject; 32 | if(createTarget == null){ return; } 33 | EditorGUILayout.SelectableLabel("CreateGObj: "+createTarget.name); 34 | 35 | hoopCourse = createTarget; 36 | if(createTarget != null){ 37 | if( GUILayout.Button("Create") ){ 38 | Create(); 39 | } 40 | // if( GUILayout.Button("Clear") ){ 41 | // Clear(); 42 | // } 43 | } 44 | 45 | EditorGUILayout.SelectableLabel("pathLength: "+pathLength); 46 | // EditorGUILayout.se 47 | // myBool = EditorGUILayout.Toggle ("Toggle", myBool); 48 | // myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); 49 | // EditorGUILayout.EndToggleGroup (); 50 | } 51 | 52 | private float split = 30; 53 | public float distance = 500; 54 | 55 | private float pathLength = 0; 56 | 57 | public void Create() 58 | { 59 | Clear(); 60 | 61 | if(bezierPathDrawer == null){ 62 | return; 63 | } 64 | 65 | // draw 66 | BezierPath path = bezierPathDrawer.GetBezierPath(); 67 | pathLength = path.length; 68 | split = (pathLength / distance); 69 | float delta = 1.0f / split; 70 | 71 | 72 | for (int i = 0; i < split; i++) { 73 | 74 | float v = delta * i; 75 | 76 | BezierPointInfo pInfo = path.GetBezierPointInfo(v); 77 | 78 | // Hoop gObj = GameObject.Instantiate(hoopPrefab); 79 | GameObject gObj = ((GameObject)PrefabUtility.InstantiatePrefab (hoopPrefab)); 80 | gObj.transform.SetParent(hoopCourse.transform); 81 | 82 | gObj.transform.position = pInfo.point; 83 | gObj.transform.rotation = pInfo.rotation; 84 | 85 | gObj.gameObject.name = "Prot_"+i; 86 | } 87 | } 88 | 89 | public void Clear() 90 | { 91 | Transform[] ts = hoopCourse.GetComponentsInChildren (); 92 | for (int i = 0; i < ts.Length; i++) { 93 | if (ts [i] != hoopCourse.transform) { 94 | DestroyImmediate (ts [i].gameObject); 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPathDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Bezier; 5 | 6 | #if UNITY_EDITOR 7 | using UnityEditor; 8 | #endif 9 | 10 | public class BezierPathDrawer : MonoBehaviour 11 | { 12 | public BezierPath path; 13 | 14 | [SerializeField] float precision = 0.05f; 15 | public List bPoints; 16 | 17 | [SerializeField] bool useLocalSpace = false; 18 | 19 | // Use this for initialization 20 | void Awake() 21 | { 22 | if (bPoints == null || bPoints.Count < 2) { return; } 23 | path = GetBezierPath(precision); 24 | } 25 | 26 | 27 | [Header("debug")] 28 | public Color drawColor = Color.yellow; 29 | public int split = 30; 30 | 31 | [SerializeField, Header("処理が重い時はチェックを外すか、GameObjectを非表示に")] bool isDrawGizmos = true; 32 | [SerializeField] bool isDrawPoints = false; 33 | 34 | [SerializeField] public float _length = 0;// for Debug 35 | 36 | void OnDrawGizmos () 37 | { 38 | if (!isDrawGizmos){ return; } 39 | //if(Application.isPlaying){ return; } 40 | 41 | if (bPoints == null || bPoints.Count < 2) { return; } 42 | 43 | bool isChange = false; 44 | // -------- 45 | // delete point 46 | for (int i = bPoints.Count-1; i >= 0; i--) { 47 | BezierPt b = bPoints [i]; 48 | if (b == null) { 49 | bPoints.RemoveAt (i); 50 | isChange = true; 51 | } 52 | } 53 | 54 | // transformの変更検知 55 | for (int i = 0; i < bPoints.Count; i++) { 56 | BezierPt b = bPoints[i]; 57 | if (b.isTransformChange) { 58 | isChange = true; 59 | break; 60 | } 61 | } 62 | 63 | // -------- 64 | // updatePath 65 | if (isChange || path == null){ 66 | path = GetBezierPath(precision); 67 | } 68 | 69 | // -------- 70 | // draw 71 | float delta = 1.0f / split; 72 | 73 | Gizmos.color = drawColor; 74 | for (int i = 0; i < split-1; i++) { 75 | if(i % 2 == 0){ 76 | float t0 = delta * i; 77 | float t1 = delta * (i + 1); 78 | Vector3 pos0 = GetPointAt (t0); 79 | Vector3 pos1 = GetPointAt (t1); 80 | 81 | Gizmos.DrawLine (pos0, pos1); 82 | } 83 | } 84 | 85 | if (isDrawPoints) { 86 | // point and tangent 87 | for (int i = 0; i < split; i++) { 88 | 89 | float v = delta * i; 90 | 91 | BezierPointInfo pInfo = GetBezierPointInfo(v); 92 | 93 | Vector3 pt = pInfo.point; 94 | Gizmos.color = drawColor; 95 | Gizmos.DrawWireSphere (pt, 0.25f); 96 | 97 | // tangent 98 | Gizmos.color = Color.blue; 99 | Vector3 tangent = pInfo.tangent; 100 | Gizmos.DrawRay (pt, tangent); 101 | 102 | Quaternion quat = pInfo.rotation; 103 | Gizmos.color = Color.green; 104 | Gizmos.DrawRay (pt, quat * Vector3.up); 105 | Gizmos.color = Color.red; 106 | Gizmos.DrawRay (pt, quat * Vector3.right); 107 | } 108 | } 109 | } 110 | 111 | public float length { 112 | get { 113 | if (path != null) { 114 | return path.length; 115 | } else { 116 | return 0; 117 | } 118 | } 119 | } 120 | 121 | private Vector3 GetPointAt (float p) 122 | { 123 | if (path != null) { 124 | return path.point (p); 125 | } else { 126 | return Vector3.zero; 127 | } 128 | } 129 | 130 | public BezierPointInfo GetBezierPointInfo(float ratio, float tangentAddPer = 0.001f) 131 | { 132 | if (path != null){ 133 | return path.GetBezierPointInfo(ratio, tangentAddPer); 134 | }else { 135 | return null; 136 | } 137 | } 138 | 139 | public BezierPath GetBezierPath(float precision = 0.05f) 140 | { 141 | List rotList = new List(); 142 | for (int i = 0; i < bPoints.Count; i++) { 143 | BezierPt b = bPoints[i]; 144 | if (useLocalSpace) { 145 | rotList.Add(b.transform.localRotation); 146 | } else { 147 | rotList.Add(b.transform.rotation); 148 | } 149 | } 150 | 151 | List nodes = new List(); 152 | for (int i = 0; i < bPoints.Count - 1; i++) { 153 | BezierPt start = bPoints[i]; 154 | BezierPt end = bPoints[i + 1]; 155 | 156 | if (useLocalSpace) { 157 | nodes.Add(this.transform.InverseTransformPoint(start.transform.position)); 158 | nodes.Add(this.transform.InverseTransformPoint(end.inTrans.position)); 159 | nodes.Add(this.transform.InverseTransformPoint(start.outTrans.position)); 160 | nodes.Add(this.transform.InverseTransformPoint(end.transform.position)); 161 | } else { 162 | nodes.Add(start.transform.position); 163 | nodes.Add(end.inTrans.position); 164 | nodes.Add(start.outTrans.position); 165 | nodes.Add(end.transform.position); 166 | } 167 | } 168 | 169 | BezierPath bp = new BezierPath(nodes.ToArray(), rotList.ToArray(), precision); 170 | _length = bp.length; 171 | 172 | return bp; 173 | } 174 | 175 | // editor 176 | #if UNITY_EDITOR 177 | [SerializeField, HideInInspector] BezierPt pointPrefab; 178 | 179 | [ContextMenu("+ AddPoint")] 180 | void CreatePoint() 181 | { 182 | GameObject gObj = ((GameObject)PrefabUtility.InstantiatePrefab (pointPrefab.gameObject)); 183 | gObj.transform.SetParent(this.transform); 184 | 185 | Transform trans = gObj.transform; 186 | 187 | if (bPoints == null || bPoints.Count < 1) { 188 | bPoints = new List (); 189 | 190 | trans.localPosition = Vector3.zero; 191 | trans.localRotation = Quaternion.identity; 192 | }else{ 193 | Transform preTrans = bPoints[bPoints.Count-1].transform; 194 | trans.localPosition = preTrans.localPosition; 195 | trans.localRotation = preTrans.localRotation; 196 | } 197 | 198 | BezierPt pt = gObj.GetComponent (); 199 | bPoints.Add (pt); 200 | 201 | gObj.name = "Bezier ("+(bPoints.Count-1)+")"; 202 | } 203 | 204 | #endif 205 | } 206 | -------------------------------------------------------------------------------- /Assets/BezierPath/BezierPath.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | namespace Bezier{ 6 | // original LeanTween: https://www.assetstore.unity3d.com/jp/#!/content/3595 7 | public class BezierPath{ 8 | public Vector3[] pts; 9 | public float length; 10 | public bool orientToPath; 11 | public bool orientToPath2d; 12 | 13 | private Bezier[] beziers; 14 | private float[] lengthRatio; 15 | private int currentBezier=0,previousBezier=0; 16 | 17 | public BezierPath(){ } 18 | public BezierPath( Vector3[] pts_ , Quaternion[] rots, float precision = 0.05f){ 19 | setPoints( pts_ , rots, precision); 20 | } 21 | 22 | public void setPoints( Vector3[] pts_, Quaternion[] rots , float precision = 0.05f){ 23 | if(pts_.Length<4) 24 | Debug.LogError( "LeanTween - When passing values for a vector path, you must pass four or more values!" ); 25 | if(pts_.Length%4!=0) 26 | Debug.LogError( "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..." ); 27 | 28 | pts = pts_; 29 | 30 | int k = 0; 31 | beziers = new Bezier[ pts.Length / 4 ]; 32 | lengthRatio = new float[ beziers.Length ]; 33 | int i; 34 | length = 0; 35 | for(i = 0; i < pts.Length; i+=4){ 36 | // beziers[k] = new Bezier(pts[i+0],pts[i+2],pts[i+1],pts[i+3],0.05f, rots[i/4], rots[i/4+1]); 37 | beziers[k] = new Bezier(pts[i+0],pts[i+2],pts[i+1],pts[i+3], precision, rots[i/4], rots[i/4+1]); 38 | length += beziers[k].length; 39 | k++; 40 | } 41 | // Debug.Log("beziers.Length:"+beziers.Length + " beziers:"+beziers); 42 | for(i = 0; i < beziers.Length; i++){ 43 | lengthRatio[i] = beziers[i].length / length; 44 | } 45 | } 46 | 47 | /** 48 | * Retrieve a point along a path 49 | * 50 | * @method point 51 | * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) 52 | * @return {Vector3} Vector3 position of the point along the path 53 | * @example 54 | * transform.position = ltPath.point( 0.6f ); 55 | */ 56 | public Vector3 point( float ratio ){ 57 | float added = 0.0f; 58 | for(int i = 0; i < lengthRatio.Length; i++){ 59 | added += lengthRatio[i]; 60 | if(added >= ratio) 61 | return beziers[i].point( (ratio-(added-lengthRatio[i])) / lengthRatio[i] ); 62 | } 63 | return beziers[lengthRatio.Length-1].point( 1.0f ); 64 | } 65 | public Quaternion rot( float ratio ){ 66 | float added = 0.0f; 67 | for(int i = 0; i < lengthRatio.Length; i++){ 68 | added += lengthRatio[i]; 69 | if(added >= ratio) 70 | return beziers[i].rot( (ratio-(added-lengthRatio[i])) / lengthRatio[i] ); 71 | } 72 | return beziers[lengthRatio.Length-1].rot( 1.0f ); 73 | } 74 | 75 | public BezierPointInfo GetBezierPointInfo( float ratio, float tangentAddPer = 0.001f ){ 76 | float added = 0.0f; 77 | for(int i = 0; i < lengthRatio.Length; i++){ 78 | added += lengthRatio[i]; 79 | if(added >= ratio){ 80 | float t = (ratio-(added-lengthRatio[i])) / lengthRatio[i] ; 81 | return beziers[i].GetPointInfo(t, tangentAddPer); 82 | } 83 | } 84 | return beziers[lengthRatio.Length-1].GetPointInfo( 1.0f ); 85 | } 86 | 87 | public void place2d( Transform transform, float ratio ){ 88 | transform.position = point( ratio ); 89 | ratio += 0.001f; 90 | if(ratio<=1.0f){ 91 | Vector3 v3Dir = point( ratio ) - transform.position; 92 | float angle = Mathf.Atan2(v3Dir.y, v3Dir.x) * Mathf.Rad2Deg; 93 | transform.eulerAngles = new Vector3(0, 0, angle); 94 | } 95 | } 96 | 97 | public void placeLocal2d( Transform transform, float ratio ){ 98 | transform.localPosition = point( ratio ); 99 | ratio += 0.001f; 100 | if(ratio<=1.0f){ 101 | Vector3 v3Dir = transform.parent.TransformPoint( point( ratio ) ) - transform.localPosition; 102 | float angle = Mathf.Atan2(v3Dir.y, v3Dir.x) * Mathf.Rad2Deg; 103 | transform.eulerAngles = new Vector3(0, 0, angle); 104 | } 105 | } 106 | 107 | /** 108 | * Place an object along a certain point on the path (facing the direction perpendicular to the path) 109 | * 110 | * @method place 111 | * @param {Transform} transform:Transform the transform of the object you wish to place along the path 112 | * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) 113 | * @example 114 | * ltPath.place( transform, 0.6f ); 115 | */ 116 | public void place( Transform transform, float ratio ){ 117 | place( transform, ratio, Vector3.up ); 118 | 119 | } 120 | 121 | /** 122 | * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path 123 | * 124 | * @method place 125 | * @param {Transform} transform:Transform the transform of the object you wish to place along the path 126 | * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) 127 | * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up 128 | * @example 129 | * ltPath.place( transform, 0.6f, Vector3.left ); 130 | */ 131 | public void place( Transform transform, float ratio, Vector3 worldUp ){ 132 | transform.position = point( ratio ); 133 | ratio += 0.001f; 134 | if(ratio<=1.0f) 135 | transform.LookAt( point( ratio ), worldUp ); 136 | 137 | } 138 | 139 | /** 140 | * Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space 141 | * 142 | * @method placeLocal 143 | * @param {Transform} transform:Transform the transform of the object you wish to place along the path 144 | * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) 145 | * @example 146 | * ltPath.placeLocal( transform, 0.6f ); 147 | */ 148 | public void placeLocal( Transform transform, float ratio ){ 149 | placeLocal( transform, ratio, Vector3.up ); 150 | } 151 | 152 | /** 153 | * Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space 154 | * 155 | * @method placeLocal 156 | * @param {Transform} transform:Transform the transform of the object you wish to place along the path 157 | * @param {float} ratio:float ratio of the point along the path you wish to receive (0-1) 158 | * @param {Vector3} rotation:Vector3 the direction in which to place the transform ex: Vector3.up 159 | * @example 160 | * ltPath.placeLocal( transform, 0.6f, Vector3.left ); 161 | */ 162 | public void placeLocal( Transform transform, float ratio, Vector3 worldUp ){ 163 | transform.localPosition = point( ratio ); 164 | ratio += 0.001f; 165 | if(ratio<=1.0f) 166 | transform.LookAt( transform.parent.TransformPoint( point( ratio ) ), worldUp ); 167 | } 168 | 169 | public void gizmoDraw(float t = -1.0f) 170 | { 171 | Vector3 prevPt = point(0); 172 | 173 | for (int i = 1; i <= 120; i++) 174 | { 175 | float pm = (float)i / 120f; 176 | Vector3 currPt2 = point(pm); 177 | //Gizmos.color = new Color(UnityEngine.Random.Range(0f,1f),UnityEngine.Random.Range(0f,1f),UnityEngine.Random.Range(0f,1f),1); 178 | Gizmos.color = (previousBezier == currentBezier) ? Color.magenta : Color.grey; 179 | Gizmos.DrawLine(currPt2, prevPt); 180 | prevPt = currPt2; 181 | previousBezier = currentBezier; 182 | } 183 | } 184 | } 185 | 186 | 187 | public class Bezier{ 188 | public float length; 189 | 190 | private Vector3 a; 191 | private Vector3 aa; 192 | private Vector3 bb; 193 | private Vector3 cc; 194 | private float len; 195 | private float[] arcLengths; 196 | 197 | private Quaternion startRot; 198 | private Quaternion endRot; 199 | 200 | public Bezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float precision, Quaternion startRot_, Quaternion endRot_){ 201 | this.a = a; 202 | aa = (-a + 3*(b-c) + d); 203 | bb = 3*(a+c) - 6*b; 204 | cc = 3*(b-a); 205 | 206 | this.len = 1.0f / precision; 207 | arcLengths = new float[(int)this.len + (int)1]; 208 | arcLengths[0] = 0; 209 | 210 | Vector3 ov = a; 211 | Vector3 v; 212 | float clen = 0.0f; 213 | for(int i = 1; i <= this.len; i++) { 214 | v = bezierPoint(i * precision); 215 | clen += (ov - v).magnitude; 216 | this.arcLengths[i] = clen; 217 | ov = v; 218 | } 219 | this.length = clen; 220 | 221 | // 222 | this.startRot = startRot_; 223 | this.endRot = endRot_; 224 | } 225 | 226 | private float map(float u) { 227 | float targetLength = u * this.arcLengths[(int)this.len]; 228 | int low = 0; 229 | int high = (int)this.len; 230 | int index = 0; 231 | while (low < high) { 232 | index = low + ((int)((high - low) / 2.0f) | 0); 233 | if (this.arcLengths[index] < targetLength) { 234 | low = index + 1; 235 | } else { 236 | high = index; 237 | } 238 | } 239 | if(this.arcLengths[index] > targetLength) 240 | index--; 241 | if(index<0) 242 | index = 0; 243 | 244 | return (index + (targetLength - arcLengths[index]) / (arcLengths[index + 1] - arcLengths[index])) / this.len; 245 | } 246 | 247 | private Vector3 bezierPoint(float t){ 248 | return ((aa* t + (bb))* t + cc)* t + a; 249 | } 250 | 251 | public Vector3 point(float t){ 252 | return bezierPoint( map(t) ); 253 | } 254 | 255 | public Quaternion rot(float t){ 256 | return Quaternion.Lerp(startRot, endRot, map(t)); 257 | } 258 | 259 | public BezierPointInfo GetPointInfo(float t, float tangentAddPer = 0.001f) 260 | { 261 | BezierPointInfo pInfo = new BezierPointInfo(); 262 | float v = map(t); 263 | pInfo.point = bezierPoint( v ); 264 | 265 | Vector3 tangent = (this.point (v + tangentAddPer) - this.point (v)).normalized; 266 | pInfo.tangent = tangent; 267 | 268 | Quaternion q = Quaternion.Lerp(startRot, endRot, v); 269 | Vector3 up = Vector3.Cross (tangent, q * Vector3.right); 270 | pInfo.rotation = Quaternion.LookRotation(tangent, up); 271 | 272 | return pInfo; 273 | } 274 | } 275 | 276 | /// 277 | /// Bezier point info. 278 | /// 279 | public class BezierPointInfo 280 | { 281 | public Vector3 point; 282 | public Quaternion rotation; 283 | public Vector3 tangent; 284 | } 285 | } --------------------------------------------------------------------------------