Skip to content

Commit

Permalink
README upd, 3d pickable upd.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Jul 14, 2024
1 parent 8be7819 commit 613dbe4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Particles of different types are visualized in different colors. Their propertie
2. **Gravity coefficient matrix for linked particles** shows whether a particle of one type will attract or repel a particle of another type in the case when they are linked to each other, and with what force.
3. **Connection limit map** shows the maximum number of links for particles of each type.
4. **Connection limit matrix** shows the maximum number of connections that particles of each type can have with particles of different types.
5. **Tensor of influence on neighbors links** shows how particles of type A affect the maximum link lengths of particles of type B with particles of type C.
5. **Connection weight matrix** shows the weight occupied by the link between a particle of type A and a particle of type B in the overall limit on the number of bonds of a particle of type A (in Connection limit map).
6. **Tensor of influence on neighbors links** shows how particles of type A affect the maximum link lengths of particles of type B with particles of type C.

The main goal of this project is to study self-organizing systems and explore configurations in which conditions for
spontaneous emergence of artificial life will be present.
Expand Down
15 changes: 14 additions & 1 deletion src/lib/drawer/3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Drawer3d implements DrawerInterface {

atomMesh.material = material;
atomMesh.freezeNormals();
atomMesh.isPickable = false;
// atomMesh.isPickable = false;
atomMesh.cullingStrategy = BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION;

return atomMesh;
Expand Down Expand Up @@ -275,6 +275,19 @@ export class Drawer3d implements DrawerInterface {
});

this.scene.onPointerDown = (event, pickResult) => {
if (pickResult.pickedMesh) {
const pos = pickResult.pickedMesh.getAbsolutePosition();
try {
this.eventManager.triggerMouseDown({
coords: [pos.x, pos.y, pos.z],
extraKey: keyDown,
ctrlKey: event.ctrlKey,
});
} catch (e) {
return;
}
}

if (event.button == 0) {
const pos = this.camera.position.add(pickResult.ray!.direction.multiplyByFloats(500, 500, 500));

Expand Down
2 changes: 1 addition & 1 deletion src/lib/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export class Simulation implements SimulationInterface {
if (grabbedAtom) {
console.log('ATOM FOUND', grabbedAtom);
}
throw new PreventException();
throw new PreventException('prevent exception');
});

this.drawer.eventManager.onMouseGrab((event) => {
Expand Down

0 comments on commit 613dbe4

Please sign in to comment.