{"id":7817,"date":"2024-07-05T10:01:01","date_gmt":"2024-07-05T02:01:01","guid":{"rendered":""},"modified":"2024-07-05T10:01:01","modified_gmt":"2024-07-05T02:01:01","slug":"unity\u6839\u636e\u8fd0\u52a8\u8f68\u8ff9\u753b\u7ebf_openlayers\u83dc\u9e1f\u6559\u7a0b","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7817.html","title":{"rendered":"unity\u6839\u636e\u8fd0\u52a8\u8f68\u8ff9\u753b\u7ebf_openlayers\u83dc\u9e1f\u6559\u7a0b"},"content":{"rendered":"
<\/p>\n
Curvy\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u7b2c\u4e09\u65b9\u63d2\u4ef6\uff0c\u7528\u4e8e\u5728unity\u4e2d\u5feb\u901f\u751f\u6210\u6e38\u620f\u8f68\u9053\uff0c\u5173\u4e8e\u6b64\u63d2\u4ef6\u7684\u6559\u7a0b\u7f51\u4e0a\u51e0\u4e4e\u627e\u4e0d\u5230\uff0c\u5b98\u65b9\u7684\u89c6\u9891\u6559\u7a0b\u662f\u4e00\u4e2a\u8bb2\u6cd5\u5f0f\u82f1\u8bed\u7684\u4eba\u8bb2\u7684\uff0c\u4e0d\u4f46\u89c6\u9891\u6a21\u7cca\u8ba9\u4eba\u542c\u7684\u7b80\u76f4\u7206\u70b8\uff0c\u6211\u53cd\u6b63\u542c\u4e86\u4e00\u534a\u5dee\u70b9\u7838\u7535\u8111\u4e86\uff0c\u6700\u540e\u4e3b\u8981\u8fd8\u662f\u9760\u6298\u817edemo\u7ed3\u5408\u89c6\u9891\u628a\u4e3b\u8981\u7684\u7528\u6cd5\u5f04\u660e\u767d\u4e86\u3002\u8fd9\u91cc\u7ed3\u5408\u5b98\u65b9demo\u4e2d\u7684\u51e0\u4e2a\u4ecb\u7ecd\u8fd9\u4e2a\u63d2\u4ef6\u7684\u7528\u6cd5\uff0c\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u5b66\u4f1a\u540e\u53ef\u4ee5\u8f7b\u677e\u62d6\u51fa\u4e00\u6761\u751a\u81f3\u591a\u6761\u590d\u6742\u7684\u8f68\u8ff9\uff0c\u7136\u540e\u53ef\u4ee5\u8ba9\u7269\u4f53\u6cbf\u7740\u8f68\u8ff9\u8fd0\u52a8\uff0c\u66f4\u5f3a\u5927\u7684\u662f\u53ef\u4ee5\u5728\u8f68\u8ff9\u4e0a\u52a8\u6001\u751f\u6210\u76f8\u5e94\u7684\u8d5b\u9053\u548c\u8f68\u9053\uff0c\u53ef\u4ee5\u63a7\u5236\u521a\u4f53\u5728\u8f68\u9053\u4e0a\u81ea\u7531\u8fd0\u52a8\u3002
\n <\/p>\n
<\/p>\n
Unity\u8d44\u6e90\u5546\u5e97\u7684curvy\u63d2\u4ef6\u94fe\u63a5\uff08\u6709\u89c6\u9891\u6559\u7a0b\u548c\u76f8\u5e94\u8bba\u575b\uff09\uff1ahttps:\/\/www.assetstore.unity3d.com\/cn\/#!\/content\/7038<\/p>\n
\u5148\u4e0a\u51e0\u5f20\u5b98\u65b9demo\u70ab\u9177\u6548\u679c\u7684\u9ad8\u6e05\u622a\u56fe\uff1a <\/p>\n <\/p>\n (1) \u7b2c\u4e00\u5f20\u56fe\u662f\u5b98\u65b9demo\u7684\u7b2c\u4e00\u4e2aSplineController.sence,\u5c55\u793a\u4e86\u98de\u884c\u5668\u6270\u7b80\u5355\u7684\u5706\u8f68\u8ff9\u5faa\u73af\u8fd0\u52a8\uff1b<\/p>\n (2) \u7b2c\u4e8c\u5f20\u56fe\u5c55\u793a\u4e86\u751f\u6210\u8f68\u8ff9\u5e76\u58f0\u79f0\u8f68\u8ff9\u5bf9\u5e94\u7684\u8f68\u9053\uff0c\u98de\u884c\u5668\u6cbf\u8f68\u8ff9\u5728\u8f68\u9053\u5185\u7a7f\u68ad\uff1b \u5728\u5de5\u7a0b\u4e2d\u9009\u62e9custom package\uff0c\u5bfc\u5165curvy\u63d2\u4ef6\uff0c\u6211\u8fd9\u91cc\u6709\u4e2av2.0.2\u7248\u672c\u7684curvy\u63d2\u4ef6\u4f9b\u4e0b\u8f7d\uff0c\u8fd9\u662f\u4e2a\u4ed8\u8d39\u63d2\u4ef6\uff0c\u8fd8\u633a\u8d35\u7684\uff0c\u514d\u8d39\u9001\u5927\u5bb6\uff1a https:\/\/pan.baidu.com\/s\/1i4SYJHV \u5982\u679c\u4e0b\u8f7d\u4e0d\u4e86\u8bf7\u56de\u590d\u90ae\u7bb1\u5730\u5740\u6211\u53d1\u7ed9\u60a8\u3002 <\/p>\n <\/p>\n \u5bfc\u5165\u63d2\u4ef6\u540e\u53ef\u770b\u5230\u4e00\u4e2apackages\u7684\u6587\u4ef6\u5939\u91cc\u9762\u6709\u4ee5\u4e0b\u5185\u5bb9\uff0c\u5176\u4e2d\u6709\u5f88\u591ademo\u573a\u666f\uff1a \u53ef\u4ee5\u8fd0\u884cdemo\u770b\u4e00\u4e0b\u53ef\u4ee5\u5b9e\u73b0\u90a3\u4e9b\u6548\u679c\uff0c\u8fd8\u662f\u5f88\u70ab\u9177\u7684\u3002 <\/p>\n \u4e8c\u3001\u5236\u4f5cSpline\u8fd0\u52a8\u8f68\u8ff9<\/strong><\/span><\/p>\n <\/p>\n 1.\u65b0\u5efa\u4e00\u4e2a\u573a\u666f\uff0c\u4f1a\u53d1\u73b0\u5bfc\u5165\u63d2\u4ef6\u540e\u5de5\u7a0b\u4e2d\u7684\u573a\u666fscene\u7a97\u53e3\u51fa\u73b0\u4e00\u4e9b\u64cd\u4f5c\u6309\u94ae\uff1a<\/span><\/strong><\/p>\n <\/p>\n <\/p>\n 2.\u751f\u6210\u8f68\u8ff9<\/span><\/strong><\/p>\n \u6700\u5feb\u7684\u65b9\u6cd5\u5c31\u662f\u76f4\u63a5\u70b9\u51fbscene\u573a\u666f\u4e2d\u4e0a\u9762\u6309\u94ae\u7684\u6700\u540e\u4e00\u4e2aDraw Spline\u6309\u94ae\uff0c\u7136\u540e\u9009\u62e9\u8f68\u8ff9\u7684\u65b9\u5411\uff0c\u4e00\u822c\u9009\u62e9\u7b2c\u4e8c\u4e2ay\u8f74\u671d\u4e0a\u3002\u9009\u62e9\u540e\u4f1a\u6709\u63d0\u793a <\/p>\n <\/p>\n \u63a7\u5236\u70b9\u4e4b\u95f4\u7684\u63d2\u503c\u6709\u4e09\u79cd\u9009\u62e9\uff0clinear\u7ebf\u6027\u63d2\u503c\u5c31\u662f\u63a7\u5236\u70b9\u4e4b\u95f4\u7528\u76f4\u7ebf\u94fe\u63a5\uff0c\u53e6\u5916\u8fd8\u6709\u4e24\u79cd\u66f2\u7ebf\u63d2\u503c\u5fc5\u5165\u585e\u5317\u5c14\u66f2\u7ebf\uff0c\u6839\u636e\u9700\u8981\u8fdb\u884c\u9009\u62e9\uff1b<\/p>\n \u63a7\u5236\u70b9\u751f\u6210\u7684\u66f2\u7ebf\u8f68\u8ff9\u53ef\u4ee5\u9009\u62e9\u95ed\u5408\u6216\u4e0d\u95ed\u5408\uff1b<\/p>\n <\/p>\n 3.\u6dfb\u52a0\u6cbf\u8f68\u8ff9\u8fd0\u52a8\u7684\u6e38\u620f\u7269\u4f53<\/span><\/strong><\/p>\n <\/p>\n \u8f68\u8ff9\u5236\u4f5c\u597d\u540e\u73b0\u5728\u6dfb\u52a0\u6cbf\u8f68\u8ff9\u8fd0\u52a8\u7684\u6e38\u620f\u7269\u4f53\uff0c\u6bd4\u5982\u6700\u7b80\u5355\u7684\u6dfb\u52a0\u4e00\u4e2a\u5706\u7403\u3002\u63d2\u4ef6demo\u4e2d\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7ed1\u5b9a\u7269\u4f53\u548cspline\u8f68\u8ff9\u5bf9\u8c61\u7684\u811a\u672c\uff0c\u5728project\u9762\u677f\u641c\u7d22splinecontroller\u811a\u672c\uff0c\u62d6\u52a8\u5230\u5706\u7403\u7269\u4f53\u4e0a\uff0c\u7136\u540e\u5c06\u4e0a\u9762\u5236\u4f5c\u597d\u7684curvy spline\u62d6\u52a8\u8d4b\u7ed9splinecontroller\u4e2d\u7684\u53d8\u91cf\u8fdb\u884c\u7ed1\u5b9a\uff0c\u540c\u65f6\u8bbe\u7f6e\u4e00\u4e0b\u8fd0\u52a8\u901f\u5ea6speed\uff0c\u9ed8\u8ba4\u662f0\u770b\u4e0d\u5230\u6548\u679c\uff0c\u7136\u540e\u8fd0\u884c\u4e00\u4e0b\u5c31\u53ef\u4ee5\u770b\u5230\u5706\u7403\u6cbf\u7740\u8f68\u8ff9\u5f00\u59cb\u79fb\u52a8\u4e86\u3002\u5f53\u7136\u8fd9\u4e2a\u811a\u672c\u7684\u529f\u80fd\u662f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\uff0c\u7ee7\u627f\u81eacurvycontroller\u811a\u672c\u3002<\/p>\n <\/p>\n <\/p>\n <\/p>\n <\/p>\n <\/p>\n \u4e0a\u9762\u53ea\u662f\u5229\u7528spline\u8f68\u8ff9\u63a7\u5236\u7269\u4f53\u8fd0\u52a8\uff0c\u4f46\u5b9e\u9645\u4e0a\u6709\u4e86\u8fd9\u6761\u8f68\u8ff9\u6570\u636e\uff0c\u6211\u4eec\u53ef\u4ee5\u751f\u6210\u76f8\u5e94\u7684\u8dd1\u9053\uff0c\u8d5b\u9053\u7b49\u7b49\uff0c\u751a\u81f3\u53ef\u4ee5\u5229\u7528\u8fd9\u6761\u8f68\u8ff9\u6570\u636e\u751f\u6210\u4efb\u4f55\u60f3\u8981\u7684\u8f68\u8ff9\u5f62\u72b6\u7684\u7269\u4f53\u573a\u666f\u3002<\/p>\n \u8f68\u9053\u7684\u751f\u6210\u6b64\u63d2\u4ef6\u63d0\u4f9b\u4e86\u4e00\u4e2agenerator\u7f16\u8f91\u5668\uff0c\u5728spline\u8f68\u8ff9\u63d0\u4f9b\u5f62\u72b6\u6570\u636e\u7684\u57fa\u7840\u4e0a\uff0c\u6dfb\u52a0\u6750\u8d28\u6570\u636e\u6a21\u5757\uff0c\u8f68\u9053\u6a2a\u622a\u9762\u7f16\u8f91\u6a21\u5757\u6765\u81ea\u7531\u63a7\u5236\u8d5b\u9053\u7684\u5f62\u72b6\u72b6\u6001\u548c\u6750\u8d28\u3002<\/p>\n <\/p>\n 1.\u65b0\u5efagenerator\u7ec4\u4ef6<\/span><\/strong><\/p>\n \u9996\u5148\u53f3\u952e(\u6700\u597d\u5c31\u5728curvy spline\u4e0b\u65b0\u5efa\u4f5c\u4e3a\u5b50\u7269\u4f53\u4e86) -->curvy --> generaotr\u65b0\u5efa\u4e00\u4e2ageneraotr\u5bf9\u8c61\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u70b9\u51fbsence\u7a97\u53e3\u4e2d\u7684\u6309\u94ae\u65b0\u5efa\uff0c\u6b64\u65f6generator\u4e0b\u662f\u7a7a\u7684\uff0c\u9f20\u6807\u9009\u4e2dgenerator\u540e\uff0c\u4f1a\u53d1\u73b0sense\u7a97\u53e3\u51fa\u73b0\u4e86edit\u6309\u94ae\uff0c\u70b9\u51fbedit\u6253\u5f00generaotr\u7f16\u8f91\u7a97\u53e3\uff1b<\/p>\n <\/p>\n <\/p>\n \u7531\u4e8egenerator\u8fd8\u662f\u7a7a\u7684\uff0c\u6240\u4ee5\u7f16\u8f91\u7a97\u53e3\u7a7a\u7a7a\u5982\u4e5f\uff0c\u6b64\u65f6\u53f3\u952e\u6dfb\u52a0\u4e00\u4e2a\u57fa\u672c\u7684shape extrusion\u6a21\u677f\uff0c\u4f1a\u53d1\u73b0\u7f16\u8f91\u7a97\u53e3\u51fa\u73b0\u4e86\u4e94\u4e2a\u903b\u8f91\u8fde\u63a5\u7684\u5c0f\u7a97\u53e3\uff0c\u540c\u65f6\u4f1a\u5230hierarchy\u7a97\u53e3\u4f1a\u53d1\u73b0generator\u5bf9\u8c61\u4e0b\u51fa\u73b0\u4e86\u76f8\u5e94\u7684\u5b50\u7269\u4f53\uff0c\u73b0\u5728\u5c31\u53ef\u4ee5\u8fdb\u884c\u7f16\u8f91\u8f68\u9053\u4e86\uff1b<\/p>\n <\/p>\n <\/p>\n 2.\u8f68\u9053\u7684\u8f68\u8ff9\u5f62\u72b6\u7ed1\u5b9a<\/span><\/strong><\/p>\n \u65b0\u5efa\u6a21\u677f\u540e\u4f1a\u53d1\u73b0\u4eceinput spline path\u94fe\u63a5\u51fa\u6765\u7684\u7a97\u53e3\u6807\u9898\u662f\u7ea2\u8272\u7684\uff0c\u90a3\u662f\u56e0\u4e3a\u540e\u9762\u7684\u4e09\u4e2a\u7a97\u53e3\u90fd\u7528\u5230\u4e86\u7b2c\u4e00\u4e2a\u7a97\u53e3\u7684path\u8f68\u8ff9\u6570\u636e\u6765\u751f\u6210\u8f68\u9053\uff0c\u7531\u4e8e\u8fd8\u6ca1\u6709\u7ed1\u5b9a\u8f68\u8ff9\u6240\u4ee5\u7ea2\u8272\u8b66\u544a\u3002\u5c06\u4e4b\u524d\u505a\u597d\u7684spline\u8f68\u8ff9\u5bf9\u8c61\u62d6\u5230input spline path\u9762\u677f\u5bf9\u5e94\u7684\u5f15\u7528\u4e0a\u5373\u53ef\uff0c<\/p>\n <\/p>\n \u4e5f\u53ef\u4ee5\u5728hierarchy\u7a97\u53e3\u62d6\u5165\u7ed1\u5b9a\uff0c\u4e24\u8fb9\u53ef\u4ee5\u76f8\u4e92\u7ed3\u5408\u5bf9\u5e94\u6765\u8bbe\u7f6e\u8c03\u6574\uff1b<\/p>\n <\/p>\n 3.\u8f68\u9053\u6a2a\u622a\u9762\u8bbe\u7f6e<\/span><\/strong><\/p>\n \u6709\u4e86\u8f68\u8ff9\u6570\u636e\u540e\u4fbf\u6709\u4e86\u5236\u4f5c\u8f68\u9053\u7684\u8f68\u8ff9\u5f62\u72b6\uff0c\u73b0\u5728\u901a\u8fc7input spline shape\u6765\u5236\u4f5c\u8f68\u9053\u7684\u6a2a\u622a\u9762\u3002\u6a2a\u622a\u9762\u7684\u5236\u4f5c\u65b9\u6cd5\u548cspline\u7684\u8f68\u8ff9\u7c7b\u4f3c\uff0c\u53ef\u4ee5\u662f\u95ed\u5408\u7684\u4e2d\u7a7a\u66f2\u7ebf\u622a\u9762\uff0c\u4e5f\u53ef\u4ee5\u662f\u5f00\u653e\u7684\u3002\u6a2a\u622a\u9762\u53ef\u4ee5\u9009\u62e9\u5df2\u6709\u7684\u89c4\u5219\u5f62\u72b6\uff0c\u6bd4\u5982\uff1a\u5706\u5f62\uff0c\u77e9\u5f62\u7b49\u7b49\uff0c\u8bbe\u7f6e\u76f8\u5e94\u7684\u63a7\u5236\u70b9\u4e2a\u6570\uff0c\u534a\u5f84\u5927\u5c0f\u7b49\u7b49\uff0c\u4e5f\u53ef\u4ee5\u9009\u4e2dfreedom\u6765\u901a\u8fc7\u591a\u4e2a\u63a7\u5236\u70b9\u6765\u5236\u4f5c\u81ea\u7531\u66f2\u7ebf\u6a2a\u622a\u9762\uff1b<\/p>\n <\/p>\n \u901a\u8fc7\u79fb\u52a8\u6a2a\u622a\u9762\u63a7\u5236\u70b9\u7684\u4f4d\u7f6e\u6765\u8c03\u6574\u6a2a\u622a\u9762\u7684\u5f62\u72b6\uff0c\u63a7\u5236\u70b9\u53ef\u4ee5\u901a\u8fc7contrl\uff0bd\u6765\u590d\u5236\u6dfb\u52a0\uff0c\u6a2a\u622a\u9762\u662f\u4e00\u4e2a\u5e73\u9762\u56fe\u5f62\uff0c\u6240\u4ee5\u4e00\u822c\u57282d\u6a21\u5f0f\u4e0b\u8bbe\u7f6e\uff0c<\/p>\n <\/p>\n \u7f16\u8f91\u65f6\u6700\u597d\u5728show gizmos\u6253\u52fe\u663e\u793a\u6a2a\u622a\u9762\u5f62\u72b6\u65b9\u4fbf\u7f16\u8f91\uff1a<\/p>\n <\/p>\n \u6ce8\u610f\uff1a\u6a2a\u622a\u9762\u66f2\u7ebf\u53ea\u6709\u5b83\u7684\u5f62\u72b6\u5bf9\u8f68\u8ff9\u8d77\u4f5c\u7528\uff0c\u5176\u4f4d\u7f6e\u5728\u54ea\u91cc\u65e0\u4efb\u4f55\u5f71\u54cd\u3002<\/strong><\/span><\/p>\n 4.\u8f68\u9053\u6750\u8d28\u8bbe\u7f6e<\/span><\/strong><\/p>\n \u8f68\u9053\u7684\u6750\u8d28\u901a\u8fc7volme mesh\u5bf9\u8c61\u6765\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u6dfb\u52a0\u591a\u4e2a\u6750\u8d28\uff0c\u9009\u4e2dmat0\uff0c\u66f4\u6539\u6750\u8d28\u5373\u53ef\uff1a<\/p>\n <\/p>\n <\/p>\n \u6ce8\u610f\uff1a\u4e0a\u9762\u7684\u8bbe\u7f6e\u6539\u53d8\u540e\u4e0d\u4f1a\u7acb\u523b\u770b\u5230\u6548\u679c\uff0c\u9700\u8981\u8fd0\u884c\u5de5\u7a0b\u6216\u8005\u8f7b\u5fae\u8c03\u6574spline\u8f68\u8ff9\u7684\u63a7\u5236\u70b9\u6765\u51fa\u53d1\u8f68\u9053\u7684\u66f4\u65b0\u663e\u793a\u3002<\/strong><\/span><\/p>\n <\/p>\n \u5982\u4e0b\u56fe\u662f\u4e00\u4e2a\u6a2a\u622a\u9762\u95ed\u5408\u7684\u7b80\u5355\u7ba1\u9053\u578b\u7684\u4e2d\u7a7a\u8f68\u9053\uff1a<\/p>\n <\/p>\n <\/p>\n @\u6269\u5c55\uff1a\u5b9e\u9645\u4e0a\u53ef\u4ee5\u5229\u7528\u4e00\u6761spline\u8f68\u8ff9\uff0c\u5728\u540c\u4e00\u4e2agenerator\u4e0b\u6dfb\u52a0\u5176\u4e0b\u7684\u591a\u4e2a\u6a21\u677f\u7ec4\u5efa\uff0c\u901a\u8fc7\u591a\u4e2a\u6a2a\u622a\u9762\u7ec4\u5408\u66f4\u590d\u6742\u7684\u8f68\u9053\u6a2a\u622a\u9762\u5f62\u72b6\u3002<\/span><\/strong><\/p>\n <\/p>\n \u56db\u3001\u751f\u6210\u5f00\u653e\u8f68\u9053\u548c\u81ea\u7531\u8fd0\u52a8\u7684\u521a\u4f53<\/span><\/strong><\/p>\n <\/p>\n \u8fd9\u91cc\u53ea\u505a\u4e00\u4e2a\u5f00\u653e\u7684\u8f68\u9053\uff0c\u5e76\u5236\u4f5c\u4e00\u4e2a\u53ef\u4ee5\u81ea\u7531\u8fd0\u52a8\u7684\u521a\u4f53\u5728\u5f00\u653e\u8f68\u9053\u4e0a\u81ea\u7531\u6d3b\u52a8\uff0c\u4e5f\u5c31\u662f\u6587\u7ae0\u5f00\u59cb\u622a\u56fe\u4e09\u8db3\u7403\u5728\u8f68\u9053\u4e0a\u6eda\u52a8\u7684\u6548\u679c\uff0c\u63d2\u4ef6\u4e2drigidbody demo\u63d0\u4f9b\u4e86\u5c55\u793a\u3002<\/p>\n \u8fd9\u65f6\u9700\u8981\u5c06\u6a2a\u622a\u9762\u505a\u6210\u4e00\u4e2a\u51f9\u69fd\u72b6\uff0c\u4ece\u800c\u53ea\u505a\u4e00\u4e2a\u51f9\u69fd\u8f68\u9053\uff0c\u53e6\u5916\u53ef\u4ee5\u901a\u8fc7\u8fd8\u6ca1\u6709\u7528\u8fc7\u7684\u5176\u4ed6\u4e24\u4e2a\u9762\u677f\u6765\u8c03\u6574\u8f68\u9053\u7684\u5f62\u6001\uff0c\u800c\u4e0d\u662f\u5bbd\u5ea6\u59cb\u7ec8\u4e00\u81f4\u7c97\u7ec6\u5747\u5300\uff0c\u53ef\u4ee5\u8ba9\u8f68\u9053\u5c81\u66f2\u7ebf\u7c97\u7ec6\u53d8\u5316\u663e\u5f97\u66f4\u81ea\u7136\u3002\u7136\u540e\u6dfb\u52a0\u4e00\u4e2a\u81ea\u7531\u8fd0\u52a8\u7684\u521a\u4f53\u6d4b\u8bd5\u8f68\u9053\u3002<\/p>\n \u4e94.\u5b9e\u65f6\u8ba1\u7b97\u7269\u4f53\u4e0espline\u8f68\u8ff9\u6700\u8fd1\u7684\u70b9\u5750\u6807<\/span><\/strong><\/p>\n <\/p>\n \u63d2\u4ef6\u63d0\u4f9b\u51fd\u6570\u7528\u6765\u8ba1\u7b97\u573a\u666f\u4e2dspline\u8f68\u8ff9\u4e0a\u79bb\u67d0\u4e2a\u7269\u4f53\u6700\u8fd1\u7684\u70b9\uff0c\u901a\u8fc7\u8fd9\u4e2a\u70b9\u53ef\u4ee5\u8ba1\u7b97\u7269\u4f53\u504f\u79bb\u8f68\u9053\u7684\u7a0b\u5ea6\u3002\u6bd4\u5982\u7ade\u901f\u6e38\u620f\u53ef\u4ee5\u5b9e\u73b0\u5b9e\u65f6\u8ba1\u7b97\u8d5b\u8f66\u504f\u79bb\u8f68\u9053\u7684\u8ddd\u79bb\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8f68\u9053\u4e0a\u6700\u8fd1\u7684\u70b9\u5750\u6807\u5bf9\u8d5b\u8f66\u8fdb\u884c\u590d\u4f4d\uff0c\u4f7f\u5176\u56de\u5230\u8f68\u9053\u4e0a\u3002\u6b64\u529f\u80fd\u63d2\u4ef6\u7684NearestPoint\u7684demo\u4e2d\u6709\u5c55\u793a\u3002<\/p>\n \u5b9e\u65f6\u83b7\u53d6\u6700\u8fd1\u70b9\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n \u8bb0\u5f97\u5728\u811a\u672c\u4e2d\u6dfb\u52a0curvy\u7684namespace\u3002 <\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":"unity\u6839\u636e\u8fd0\u52a8\u8f68\u8ff9\u753b\u7ebf_openlayers\u83dc\u9e1f\u6559\u7a0b@\u5e9f\u8bdd\u5728\u524dCurvy\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u7b2c\u4e09\u65b9\u63d2\u4ef6\uff0c\u7528\u4e8e\u5728unity\u4e2d\u5feb\u901f\u751f\u6210\u6e38\u620f\u8f68\u9053\uff0c\u5173\u4e8e...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7817"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7817"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7817\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
<\/span><\/strong>
\n
\n <\/p>\n
\n
(3) \u7b2c\u4e09\u5f20\u56fe\u5c55\u793a\u4e86\u751f\u6210\u8f68\u8ff9\u8f68\u9053\uff0c\u5e76\u63a7\u5236\u4e00\u4e2a\u521a\u4f53\u5728\u8f68\u9053\u4e0a\u81ea\u7531\u6eda\u52a8\uff1b <\/p>\n
\n\u4e00\u3001\u5bfc\u5165\u63d2\u4ef6
<\/span><\/strong> <\/p>\n
\n <\/p>\n
\n
\n <\/p>\n
<\/span><\/strong><\/p>\n
<\/span><\/strong><\/p>\n
\n\u901a\u8fc7\u6309\u4f4fcontrol\u952e\u7136\u540e\u5728scene\u573a\u666f\u4e2d\u6dfb\u52a0\u63a7\u5236\u70b9\uff0c\u53ef\u4ee5\u6dfb\u52a0\u591a\u4e2a\u63a7\u5236\u70b9\uff0c\u53ef\u4ee5\u62d6\u52a8\u63a7\u5236\u70b9\u6539\u53d8\u751f\u6210\u8f68\u8ff9\u7684\u5f62\u72b6<\/span><\/strong>\uff0c\u4e0e\u6b64\u540c\u65f6\u4f1a\u53d1\u73b0project\u9762\u677f\u4e2d\u5df2\u7ecf\u751f\u6210\u4e86\u76f8\u5e94\u7684\u5143\u7d20\uff1a\u8f68\u8ff9\u548c\u8f68\u8ff9\u4e0b\u7684\u63a7\u5236\u70b9\uff1b
\n <\/p>\n
\n\u4e09\u3001\u6839\u636eSpline\u8f68\u8ff9\u751f\u6210\u5c01\u95ed\u8fd0\u52a8\u8f68\u9053\uff08\u91cd\u70b9\u6765\u4e86\uff0cgenerator\u7684\u4f7f\u7528\uff01\uff09
<\/strong><\/span> <\/p>\n
<\/strong><\/span><\/p>\n
<\/span><\/strong><\/p>\npublic CurvySpline Spline; \/\/ spline\u8f68\u8ff9\u5bf9\u8c61 public transform target; \/\/\u8ba1\u7b97\u504f\u79bb\u7684\u7269\u4f53\uff0c\u6bd4\u5982\u8d5b\u8f66 if (Spline && Spline.IsInitialized && target) \/\/\u4fdd\u8bc1spline\u548ctarget\u5b58\u5728 { \/\/ \u5c06target\u7684\u5750\u6807\u8f6c\u6362\u5230spline\u6240\u5728\u7684\u672c\u5730\u5750\u6807\u7cfb var targetPos = Spline.transform.InverseTransformPoint(target.position); \/\/ \u83b7\u5f97target\u5728spline\u4e0a\u7684\u6700\u8fd1\u70b9\u7684TF\u503c float nearestTF=Spline.GetNearestPointTF(targetPos); \/\/ \u8f6c\u6362\u5230\u4e16\u754c\u5750\u6807\u7cfb\u7684spline\u4e0a\u6700\u8fd1\u70b9\u7684\u5750\u6807\u503c var nearestPos = Spline.transform.TransformPoint(Spline.Interpolate(nearestTF)); }<\/code><\/pre>\n