|
509 | 509 | (boxes[3].constraints.length & 1) != 0)
|
510 | 510 | console.error("expected even number of constraints");
|
511 | 511 | physics.stepSimulation(time_delta, 10);
|
512 |
| - addConnectionsForContacts(); |
513 | 512 | for (let i = 1; i < boxes.length; i++)
|
514 | 513 | btToScene(boxes[i]);
|
515 | 514 | for (let i = 0; i < SPOOL_OFFSET; i++)
|
516 | 515 | btToScene(spheres[i]);
|
| 516 | + addConnectionsForContacts(); |
517 | 517 | }
|
518 | 518 |
|
519 | 519 | const tip = new glMatrix.ARRAY_TYPE(3);
|
|
659 | 659 | sp.contact = force || (((segment.far_left.distance2D | 0) +
|
660 | 660 | (segment.far_right.distance2D | 0) > 4) &&
|
661 | 661 | (segment.count_left + segment.count_right > 8));
|
662 |
| - sp.segment_id = segment.index; |
| 662 | + sp.segment_id = segment.index; // debugging purpose only. |
663 | 663 | sp.frameid = frameid;
|
664 | 664 | sp.buffer = buffer;
|
665 | 665 | }
|
|
866 | 866 | return false;
|
867 | 867 | return buffer[key + "_square"] < 0.01;
|
868 | 868 | }
|
| 869 | + |
869 | 870 | for (let k = 0; k < keys.length; k++) {
|
870 | 871 | const buffer = getSegBuffer(k);
|
871 | 872 | // We need another sub-step here: check the distances and accept
|
|
875 | 876 | // assign the sphere.
|
876 | 877 | if (buffer.endpoint_tip && buffer.sp1 &&
|
877 | 878 | bothHoldsValidAssignment("sp1", buffer)) {
|
878 |
| - assignContactSphereToSegmentEndPoint(buffer, "sp1", buffer.sp1.segment); |
| 879 | + assignContactSphereToSegmentEndPoint(buffer, "sp1", buffer.sp1.segment, true); |
879 | 880 | }
|
880 | 881 | if (buffer.endpoint_base && buffer.sp2 &&
|
881 | 882 | bothHoldsValidAssignment("sp2", buffer)) {
|
882 |
| - assignContactSphereToSegmentEndPoint(buffer, "sp2", buffer.sp2.segment); |
| 883 | + assignContactSphereToSegmentEndPoint(buffer, "sp2", buffer.sp2.segment, true); |
883 | 884 | }
|
884 | 885 | }
|
885 | 886 |
|
|
1007 | 1008 | // object, but different finger balls.
|
1008 | 1009 | function canManifoldsHoldTheObject(con1, m2, ob, joint, finger) {
|
1009 | 1010 | const m1 = con1.manifold;
|
1010 |
| - let p1 = m1.getContactPoint(0); |
1011 |
| - let p2 = m2.getContactPoint(0); |
| 1011 | + const p1 = m1.getContactPoint(0); |
| 1012 | + const p2 = m2.getContactPoint(0); |
1012 | 1013 |
|
1013 | 1014 | // First, let's not allow picking objects from the lower side - to
|
1014 | 1015 | // prevent this happening when carrying objects.
|
|
1026 | 1027 | // As these are the boxes, holding if pBs are in the same.
|
1027 | 1028 | // object to hold is a box, so simplify this so that we hold it on
|
1028 | 1029 | // opposite sides of the box.
|
1029 |
| - let xdiff = Math.abs(pA1.x() - pA2.x()); |
1030 |
| - let ydiff = Math.abs(pA1.y() - pA2.y()); |
1031 |
| - let zdiff = Math.abs(pA1.z() - pA2.z()); |
| 1030 | + const xdiff = Math.abs(pA1.x() - pA2.x()); |
| 1031 | + const ydiff = Math.abs(pA1.y() - pA2.y()); |
| 1032 | + const zdiff = Math.abs(pA1.z() - pA2.z()); |
1032 | 1033 | if (!(xdiff > 0.9 * ob.scale[0] || ydiff > 0.9 * ob.scale[1] ||
|
1033 | 1034 | zdiff > 0.9 * ob.scale[2]))
|
1034 | 1035 | return false;
|
|
0 commit comments