|
167 | 167 | radius: 0.75 |
168 | 168 | }); |
169 | 169 |
|
170 | | - // import the cow |
171 | | - var assets = scene.importAssetFile('../Alembic/Models/cow.abc', { |
172 | | - dependentNode: viewport |
| 170 | + var torusNode = scene.constructNode('Torus', {detail: 24}); |
| 171 | + |
| 172 | + var softBodyNode = bulletWorldNode.addSoftBody('Torus',new FABRIC.RT.BulletSoftBody({ |
| 173 | + trianglesNode: torusNode, |
| 174 | + transform: FABRIC.RT.xfo({ |
| 175 | + tr: new FABRIC.RT.Vec3(0,10,0), |
| 176 | + }), |
| 177 | + recover: 0.01, |
| 178 | + pressure: 5, |
| 179 | + piterations: 4, |
| 180 | + })); |
| 181 | + |
| 182 | + scene.constructNode('Instance', { |
| 183 | + geometryNode: softBodyNode, |
| 184 | + materialNode: phongMaterial |
173 | 185 | }); |
| 186 | + |
| 187 | + bulletWorldNode.addAnchor('toCubeB',new FABRIC.RT.BulletAnchor({ |
| 188 | + softBodyNodeIndices: [701,702,703,704,705,706] |
| 189 | + }), |
| 190 | + 'CubeA', |
| 191 | + 'Torus' |
| 192 | + ); |
174 | 193 |
|
175 | | - assets['cow'].addOnLoadSuccessCallback(function(){ |
176 | | - // add a softbody to the sim |
177 | | - var parsedNodes = assets['cow'].getParsedNodes(); |
178 | | - var softBodyNode = bulletWorldNode.addSoftBody('Cow',new FABRIC.RT.BulletSoftBody({ |
179 | | - trianglesNode: parsedNodes['/polymsh/polymshShape'], |
180 | | - transform: FABRIC.RT.xfo({ |
181 | | - tr: new FABRIC.RT.Vec3(0,10,0), |
182 | | - }), |
183 | | - recover: 0.01, |
184 | | - //conservation: 0.6, |
185 | | - pressure: 5, |
186 | | - piterations: 4, |
187 | | - })); |
188 | | - |
189 | | - scene.constructNode('Instance', { |
190 | | - geometryNode: softBodyNode, |
191 | | - materialNode: phongMaterial |
192 | | - }); |
193 | | - |
194 | | - bulletWorldNode.addAnchor('toCubeA',new FABRIC.RT.BulletAnchor({ |
195 | | - softBodyNodeIndices: [1941, 1943, 1951, 1959, 1966, 1988, 1990, 2729, 2731, 2732, 2733, 2734, |
196 | | - 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, |
197 | | - 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, |
198 | | - 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, |
199 | | - 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, |
200 | | - 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, |
201 | | - 2795, 2796, 2797, 2798, 2799, 2812, 1973, 1982, 1984, 1986, 2806] |
202 | | - }), |
203 | | - 'CubeA', |
204 | | - 'Cow' |
205 | | - ); |
206 | | - bulletWorldNode.addAnchor('toCubeB',new FABRIC.RT.BulletAnchor({ |
207 | | - softBodyNodeIndices: [0, 1, 2, 21, 22, 23, 24, 25, 26, 29, 30, 33, 34, 35, 36, 37, 38, 39, |
208 | | - 43, 44, 45, 46, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
209 | | - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 150, 151, |
210 | | - 152, 153, 154, 155, 156, 157, 160, 161, 162, 1014, 1015, 1016, 1021, 1022, |
211 | | - 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1033, 1034, 1035, 1036, |
212 | | - 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1046, 1047, 1048, 1051, 1052, 1053, |
213 | | - 1054, 1055, 1058, 1060, 1061, 1062, 1064, 1075, 1076, 1082, 1083, 2107, 2108, |
214 | | - 2109, 2110, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, |
215 | | - 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2135, 2136] |
216 | | - }), |
217 | | - 'CubeB', |
218 | | - 'Cow' |
219 | | - ); |
220 | | - |
221 | | - $('#loadingDialog').dialog('close'); |
222 | | - viewport.redraw(); |
223 | | - }); |
| 194 | + bulletWorldNode.addAnchor('toCubeA',new FABRIC.RT.BulletAnchor({ |
| 195 | + softBodyNodeIndices: [0,1,2,3,4,5,6,7,8] |
| 196 | + }), |
| 197 | + 'CubeB', |
| 198 | + 'Torus' |
| 199 | + ); |
224 | 200 |
|
225 | 201 | FABRIC.appendOnResolveAsyncTaskCallback(function(label, nbRemaining, doneWeight, totalWeight) { |
226 | 202 | $('#loadingProgressBar').progressbar({ |
|
0 commit comments