{"id":1560,"date":"2023-11-29T15:35:09","date_gmt":"2023-11-29T07:35:09","guid":{"rendered":"https:\/\/www.mustenaka.cn\/?p=1560"},"modified":"2023-12-27T14:20:32","modified_gmt":"2023-12-27T06:20:32","slug":"pbd-method-learn-03-particle-generate","status":"publish","type":"post","link":"https:\/\/www.mustenaka.cn\/index.php\/2023\/11\/29\/pbd-method-learn-03-particle-generate\/","title":{"rendered":"PBD method\u5b66\u4e60\uff08Position Based Dynamics method learn\uff09-04 \u7c92\u5b50\u6784\u9020"},"content":{"rendered":"<h1>PBD\u7c92\u5b50\u6784\u9020<\/h1>\n<p>PBD\u7b97\u6cd5\u7684\u7b2c\u4e00\u6b65\u5c31\u662f\u9700\u8981\u8003\u8651\u5982\u4f55\u6839\u636e\u76ee\u6807\u7684\u5f62\u6001\u53bb\u6784\u5efa\u7c92\u5b50\uff0c\u5728\u8003\u8651\u76ee\u6807\u5f62\u6001\u6784\u5efa\u7684\u7b2c\u4e00\u6b65\uff0c\u5219\u9700\u8981\u601d\u8003\uff0c\u672c\u7b97\u6cd5\u5e94\u8be5\u5982\u4f55\u53bb\u8fd0\u884c\uff0c\u4e00\u822c\u6765\u8bf4\u8fd0\u884c\u65b9\u5f0f\u6709\u5982\u4e0b\u51e0\u79cd\u6a21\u5f0f<\/p>\n<ol>\n<li>GPU\u8fd0\u884c\uff1a\u5e76\u884c\u6548\u7387\u6700\u9ad8\uff0c\u4f46\u662f\u8981\u8003\u8651\u56de\u8c03\u6d88\u8017<\/li>\n<li>CPU\u5e76\u884c\uff1a\u5e76\u884c\u6548\u7387\u6b21\u9ad8\uff0c\u4f46\u662f\u8981\u8003\u8651\u5982\u4f55\u5408\u9002\u7684\u4efb\u52a1\u5206\u914d\uff0c\u4ee5\u53ca\u56de\u8c03<\/li>\n<li>\u5355\u7ebf\u7a0b\u5904\u7406\uff1a\u7f16\u5199\u6548\u7387\u6700\u7f16\u5199\uff0c\u8fd9\u6837\u53ef\u4ee5\u8003\u8651\u5229\u7528\u9ad8\u7ea7\u8bed\u8a00\u589e\u52a0\u7c92\u5b50\u6269\u5c55\u6027\uff0c\u7c92\u5b50\u6570\u5927\u5219\u8fd0\u884c\u6548\u7387\u4f4e\u4e0b<\/li>\n<\/ol>\n<p>\u6b64\u5916\u6839\u636e\u76ee\u6807\u7684\u5f62\u6001\uff08\u5982\u5e03\u6599Cloth\u3001\u67d4\u4f53Softbody\u3001\u7ef3\u7d22Rope\uff09\u4ee5\u53ca\u6548\u679c\u76ee\u6807\uff08\u8003\u8651\u78b0\u649eCollider\u3001\u7a33\u5b9a\u6027\uff08\u8003\u8651\u8fd0\u884c\u79ef\u5206\uff09\uff09\uff0c\u4e5f\u4f1a\u62e5\u6709\u4e0d\u540c\u7684\u53c2\u6570\u53bb\u5b9e\u73b0\uff0c<\/p>\n<h3>\u57fa\u672c\u7c92\u5b50\u53c2\u6570<\/h3>\n<p>\u56de\u987e\u524d\u6587\u5bf9\u8fd0\u884c\u903b\u8f91\u7684\u5206\u6790\uff0c<a href=\"https:\/\/www.mustenaka.cn\/index.php\/2023\/09\/14\/pbd-method-learn-02\/\">https:\/\/www.mustenaka.cn\/index.php\/2023\/09\/14\/pbd-method-learn-02\/<\/a>\uff0c\u4e00\u822c\u6765\u8bf4\uff0c\u6784\u9020\u4e00\u4e2a\u7a33\u5b9a\u7684\u7c92\u5b50\u7cfb\u7edf\uff0c\u6700\u9002\u5408\u662f\u4f7f\u7528Verlet\u79ef\u5206\u8fdb\u884c\u8fed\u4ee3\uff0cverlet\u79ef\u5206\u5219\u9700\u8981\u8003\u8651\uff0c\u4e0a\u4e00\u65f6\u523b\u4f4d\u7f6e\u3001\u5f53\u524d\u4f4d\u7f6e\u3001\u4e0b\u4e00\u65f6\u523b\u4f4d\u7f6e\u3002\u5f53\u524d\u5c40\u90e8\u7c92\u5b50\u7684\u8d28\u91cf\u3001\u5c40\u90e8\u7c92\u5b50\u7684\u53d7\u529b\u60c5\u51b5\uff0c\u662f\u5426\u6709\u4e00\u4e9b\u7279\u6b8a\u5904\u7406\uff08\u6bd4\u5982\u9644\u7740Pin\/Attachement\uff09,\u5982\u4e0b\uff0c\u662f\u4e00\u6bb5\u7c92\u5b50\u6838\u5fc3\u53c2\u8003\u4ee3\u7801\u5b9e\u73b0\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">    \/\/\/ &lt;summary&gt;\r\n    \/\/\/ The base type of the particle type,\r\n    \/\/\/ if you need to extend the build, please inherit this module\r\n    \/\/\/ &lt;\/summary&gt;\r\n    [System.Serializable]\r\n    public class ApexParticleBase\r\n    {\r\n        \/* position, serialize nowPosition *\/\r\n        public Vector3 previousPosition;\r\n        public Vector3 nowPosition;\r\n        public Vector3 nextPosition;\r\n        \r\n        \/* scale equal transform.TransLocalScale *\/\r\n        public Vector3 scale;\r\n        \r\n        \/* Index of the particle array *\/\r\n        public int index;\r\n        \r\n        \/* True - this particle nextPosition will not apply nowPosition *\/\r\n        public bool isStatic;\r\n        \r\n        \/* physic param *\/\r\n        public Vector3 forceExt;        \/\/ calc physic\r\n        public Vector3 forceApply;      \/\/ apply physic\r\n        public float mass;\r\n    }<\/code><\/pre>\n<p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u867d\u7136\u7c92\u5b50\u7684\u7ec4\u6210\u4f7f\u7528\u6570\u7ec4\u6d3b\u7740\u5217\u8868\u7ec4\u88c5\uff0c\u4f46\u662f\u6211\u8fd8\u662f\u8ba4\u4e3a\u9700\u8981\u7ed9\u7c92\u5b50\u7684\u7d22\u5f15\u8fdb\u884c\u4e00\u4e2a\u7f16\u53f7(index)\uff0c\u4ee5\u53ca\u7c92\u5b50\u7684\u7f29\u653e\u60c5\u51b5\u9700\u8981\u548c\u5f15\u64ce\u7684localScale\u8fdb\u884c\u5bf9\u9f50\uff0c\u987e\u989d\u5916\u8003\u8651\u4e86Scale\u548cindex\u53c2\u6570\u3002<\/p>\n<h3>Rope\uff08\u7ef3\u7d22\uff09<\/h3>\n<p>Rope\u7684\u6784\u5efa\u65b9\u5f0f\uff0c\u9996\u5148\u9700\u8981\u5206\u6790\u7ef3\u7d22\u7684\u7279\u70b9\uff0c\u4e00\u822c\u800c\u8a00\uff0c\u7ef3\u7d22\u7684\u6a21\u62df\uff0c\u662f\u6709\u4e00\u4e2a\u7c92\u5b50\u76f4\u63a5\u76f8\u90bb\u53e6\u4e00\u4e2a\u7c92\u5b50\u7684\u6784\u6210\u7684\u4e00\u4e2a\u8f83\u4e3a\u6709\u5e8f\u7684\u94fe\u5f0f\u7ed3\u6784<\/p>\n<p>&nbsp;<\/p>\n<h3>MutilRope\uff08\u591a\u53c9\u5f0f\u7ef3\u7d22\uff09<\/h3>\n<p>&nbsp;<\/p>\n<h3>Cloth\uff08\u5e03\u6599\uff09<\/h3>\n<p>&nbsp;<\/p>\n<h3>Softbody\uff08\u67d4\u4f53\uff09<\/h3>\n<p>&nbsp;<\/p>\n<p>\u3010\u672a\u5b8c\u5f85\u7eed\u3011<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PBD\u7c92\u5b50\u6784\u9020 PBD\u7b97\u6cd5\u7684\u7b2c\u4e00\u6b65\u5c31\u662f\u9700\u8981\u8003\u8651\u5982\u4f55\u6839\u636e\u76ee\u6807\u7684\u5f62\u6001\u53bb\u6784\u5efa\u7c92\u5b50\uff0c\u5728\u8003\u8651\u76ee\u6807\u5f62\u6001\u6784\u5efa\u7684\u7b2c\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,44,118],"tags":[123,116],"class_list":["post-1560","post","type-post","status-publish","format-standard","hentry","category-algorithm","category-csharp","category-unity3d","tag-pbd","tag-unity3d"],"views":1389,"_links":{"self":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1560"}],"version-history":[{"count":4,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1560\/revisions"}],"predecessor-version":[{"id":1571,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1560\/revisions\/1571"}],"wp:attachment":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}