Changeset 638 for experiments/frams/foraminifera/data/scripts
- Timestamp:
- 12/03/16 03:16:38 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r595 r638 200 200 { 201 201 // [x,y,energy] 202 cr.move(g.data->genes[0] - cr. center_x, g.data->genes[1] - cr.center_y, 0);202 cr.move(g.data->genes[0] - cr.bboxCenter.x, g.data->genes[1] - cr.bboxCenter.y, 0); 203 203 cr.energy = g.data->genes[2]; 204 204 } 205 205 else 206 206 { 207 cr.move(Math.rnd01 * World.wrldsiz - cr. center_x, Math.rnd01 * World.wrldsiz - cr.center_y, 0);207 cr.move(Math.rnd01 * World.wrldsiz - cr.bboxCenter.x, Math.rnd01 * World.wrldsiz - cr.bboxCenter.y, 0); 208 208 } 209 209 } … … 224 224 225 225 for(var cr in Populations[1]) 226 tmpvec.add([cr. center_x, cr.center_y, cr.energy]);226 tmpvec.add([cr.bboxCenter.x, cr.bboxCenter.y, cr.energy]); 227 227 228 228 ExpState.nutrient = tmpvec; … … 400 400 cr.data->reticulopodiacreature = ret; 401 401 ret.getMechPart(0).orient.set(cr.getMechPart(0).orient); 402 ret. moveAbs(cr.center_x-radius, cr.center_y-radius, cr.center_z-radius);402 ret.locationSetBboxLow(cr.bboxCenter.x-radius, cr.bboxCenter.y-radius, cr.bboxCenter.z-radius); 403 403 } 404 404 … … 421 421 if (!cr.boundingBoxCollisions(0)) 422 422 { 423 cr. moveAbs(cr.pos_x, cr.pos_y, -cr.getPart(cr.numparts-1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)423 cr.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y, -cr.getPart(cr.numparts-1).sx); //place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber) 424 424 return cr; 425 425 } … … 463 463 464 464 setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : "growth", "energy0" : cr.energy0}); 465 cr2. moveAbs(cr.pos_x, cr.pos_y,cr.pos_z);465 cr2.locationSetBboxLow(cr.bboxLow.x, cr.bboxLow.y,cr.bboxLow.z); 466 466 setForamMeta(cr2); 467 467 … … 516 516 function stepToNearest(cr) 517 517 { 518 var p = XYZ.new(cr. center_x, cr.center_y, cr.center_z);518 var p = XYZ.new(cr.bboxCenter.x, cr.bboxCenter.y, cr.bboxCenter.z); 519 519 var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2)); 520 520 … … 532 532 for (i = 0; i < n.size; i++) 533 533 { 534 mp = XYZ.new(n[i].value. center_x, n[i].value.center_y, n[i].value.center_z);534 mp = XYZ.new(n[i].value.bboxCenter.x, n[i].value.bboxCenter.y, n[i].value.bboxCenter.z); 535 535 distvec.set(mp); 536 536 distvec.sub(p); … … 597 597 //Prevents forams from crossing the world border. In the case of touching the border with the reticulopodia direction of the movement should be changed. 598 598 var change_direction = 0; 599 var new_x = fence(cr. center_x, getZoneRange(cr, 1));600 var new_y = fence(cr. center_y, getZoneRange(cr, 1));601 602 if ((new_x != cr. center_x) || (new_y != cr.center_y) || (cr.data->lifeparams->dir_counter >= int(secToSimSteps(ExpProperties.dir_change_sec))))599 var new_x = fence(cr.bboxCenter.x, getZoneRange(cr, 1)); 600 var new_y = fence(cr.bboxCenter.y, getZoneRange(cr, 1)); 601 602 if ((new_x != cr.bboxCenter.x) || (new_y != cr.bboxCenter.y) || (cr.data->lifeparams->dir_counter >= int(secToSimSteps(ExpProperties.dir_change_sec)))) 603 603 { 604 604 change_direction = 1; 605 cr. moveAbs(new_x-cr.size_x/2, new_y-cr.size_y/2, -cr.getPart(cr.numparts-1).sx);//place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber)605 cr.locationSetBboxLow(new_x-cr.bboxSize.x/2, new_y-cr.bboxSize.y/2, -cr.getPart(cr.numparts-1).sx);//place slightly under the bottom surface ("z" value depends on the size of the last=largest chamber) 606 606 } 607 607 … … 631 631 if (visualization(cr)) 632 632 { 633 cr.data->reticulopodiacreature. moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));633 cr.data->reticulopodiacreature.locationSetBboxLow(cr.bboxCenter.x-getZoneRange(cr,1), cr.bboxCenter.y-getZoneRange(cr,1), cr.bboxCenter.z-getZoneRange(cr,1)); 634 634 cr.data->reticulopodiacreature.drive = cr.drive; 635 635 } … … 779 779 function onNutrientsStep(cr) 780 780 { 781 cr. moveAbs(cr.pos_x % World.wrldsiz, cr.pos_y % World.wrldsiz, 0.5);781 cr.locationSetBboxLow(cr.bboxLow.x % World.wrldsiz, cr.bboxLow.y % World.wrldsiz, 0.5); 782 782 } 783 783 … … 800 800 var nut = Populations[2].add("//0\nm:Vstyle=nutrient_visual\np:sh=2,sx="+nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0"); 801 801 cr.data->reticulopodiacreature = nut; 802 nut. moveAbs( cr.pos_x+cr.size_x/2-nut.size_x/2, cr.pos_y+cr.size_y/2-nut.size_y/2, -nutsize);802 nut.locationSetBboxLow( cr.bboxLow.x+cr.bboxSize.x/2-nut.bboxSize.x/2, cr.bboxLow.y+cr.bboxSize.y/2-nut.bboxSize.y/2, -nutsize); 803 803 } 804 804 }
Note: See TracChangeset
for help on using the changeset viewer.