Skip to content

Instantly share code, notes, and snippets.

@hovsep
Created January 13, 2026 07:57
Show Gist options
  • Select an option

  • Save hovsep/820fd14522e2a6859849ee4eb04d0805 to your computer and use it in GitHub Desktop.

Select an option

Save hovsep/820fd14522e2a6859849ee4eb04d0805 to your computer and use it in GitHub Desktop.
Human body simulation mesh
// getSimulationMesh returns the main mesh of the simulation
func getSimulationMesh() *fmesh.FMesh {
// Set up the world
habitat := env.NewHabitat(component.NewCollection().Add(
factor.GetTimeComponent(),
factor.GetAirComponent(),
factor.GetSunComponent(),
))
// Add human beings
habitat.AddOrganisms(human.New("Leon"))
// Set up the mesh
habitat.FM.SetupHooks(func(hooks *fmesh.Hooks) {
// Generate a tick signal before each run (time step simulation)
hooks.BeforeRun(func(mesh *fmesh.FMesh) error {
mesh.ComponentByName("time").InputByName("ctl").PutSignals(signal.New("tick"))
return nil
})
})
return habitat.FM
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment