Skip to content

Instantly share code, notes, and snippets.

@JokerMartini
Created November 19, 2015 15:21
Show Gist options
  • Save JokerMartini/f8280a48978d31e1344f to your computer and use it in GitHub Desktop.
Save JokerMartini/f8280a48978d31e1344f to your computer and use it in GitHub Desktop.
--Bobo: The other way would be to use MatrixFromNormal, set the .row4 to the position of the object and assign to the .transform property.
(
s = sphere pos:[10,20,30]
t = teapot radius:5
theMesh = snapshotasmesh s
for f = 1 to theMesh.numfaces do
(
theClone = instance t
theClone.transform = matrixFromNormal (getFaceNormal theMesh f)
theClone.pos = meshop.getFaceCenter theMesh f
--ALTERNATIVE:
-- theTM = matrixFromNormal (getFaceNormal theMesh f)
-- theTM.row4 = meshop.getFaceCenter theMesh f
-- theClone.transform = theTM
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment