[Closed] Points On surface
Does anyone know of a good way to random places point helpers on the surface of and object without using any corky pflow methods?
I’d love to know a way of doing this. Thank you.
for all surface related stuff I use a custom attribute called rayIntersectGridCA
any time i need a points on a surface I add the attribute. This consists of a single local variable set to a RayMeshGridIntersect() and a single ui param of the grid size. with the source mesh hosting the ca provides the base node to the build RayMeshGridIntersect
so now when I have a scatter node, scatter spline or walk through game camera I can poll the nodes custom attribute for a surface position (in very quick time).
the game camera emulator is a riot, so much so i’ve been toying with implementing a silly mxs tank game with it
hi
i did this recently and did something like below,
It doesent generate evenly spaced points but its quite easy to eliminate points based on there proximity
hope it helps
Dave
numVerts = polyop.getNumVerts selection[1]
pts = #()
for i = 1 to numVerts do
(
append pts ( polyOp.getVert selection[1] i )
)
fn lerp minVal maxVal term =
(
return ( (maxVal - minVal) * term + minVal )
)
fn genRndPtInTri ptA ptB ptC =
(
ptD = lerp ptB ptC ( random 0.0 1.0 )
ptE = lerp ptA ptD ( random 0.0 1.0 )
Point pos:ptE isSelected:off
)
for i = 1 to 100 do
(
genRndPtInTri pts[1] pts[2] pts[3]
)
I suppose i should also say that this only works on an editable poly of a single triangle
Dave
Here is a snippet from my Voluminance script, cloud is a mesh obj. p at the bottom is a random point on a random face (vi) .
vi=getface cloud (random 1 cloud.numFaces)
r=random [0,0] [1,1]
if (r.x +r.y >1 ) do
(
r.x=1-r.x
r.y=1-r.y
)
a=getvert cloud vi[1]
b=getvert cloud vi[2]
c=getvert cloud vi[3]
ab= point3 (b.x - a.x) (b.y - a.y) ( b.z - a.z)
ac= point3 (c.x - a.x) (c.y - a.y) ( c.z - a.z)
p=a+(r.x*ab)+(r.y*ac)
ab= point3 (b.x - a.x) (b.y - a.y) ( b.z - a.z)
ac= point3 (c.x - a.x) (c.y - a.y) ( c.z - a.z)
whats wrong with
ab = b - a
ac = c - a
?