View Full Version : Birth to center of polygons with orientation
jonahhawk 06-12-2008, 03:48 AM I learned how to do it with position and verts.
Now I would like to birth at the center of faces... I'm sure I'm missing something simple.
--Sorry for the massive Tabage. They seem to grow in the thread post...
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.usePosition = true
pCont.useOrientation = true
)
on Init pCont do
(
global baseObj = $Sphere01
)
on Proceed pCont do
(
if baseObj != undefined do
(
t = pCont.getTimeStart() as float
NumFaces = getNumFaces baseObj
if t < 0 do
(
for i = 1 to NumFaces do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particlePosition = polyop.getFaceCenter baseObj i
pCont.particleOrientation = polyop.getFaceNormal baseObj i
)
)
)
)
on Release pCont do ()
|
|
Polimeno
06-12-2008, 03:57 AM
humm...
post a preview (gif or video), so we can take a look what you tring to do...
jonahhawk
06-12-2008, 04:12 AM
I have learned how to birth particles (in a birth script in PFLOW) to the position of verts of an EditablePoly. I would like to learn how to birth to the center of faces with the particles aligned to the normals of the face
http://i99.photobucket.com/albums/l298/jonahhawk/PF_BIrthPosVerts.jpg
Polimeno
06-12-2008, 04:56 AM
i think to birth i is the same way in vertex,
but becarefull to deal with 3D vectors to (get orientation XYZ) based on face normals poly.
researchs :
http://forums.cgsociety.org/showthread.php?f=98&t=310605&highlight=face+normal+vectors
http://forums.cgsociety.org/showthread.php?f=98&t=617614&highlight=face+normal+vectors (http://forums.cgsociety.org/showthread.php?f=6&t=586328)
http://forums.cgsociety.org/showthread.php?f=98&t=509556&highlight=face+normal+vectors
http://forums.cgsociety.org/showthread.php?f=98&t=337793&highlight=face+normal+vectors
check the help about it too.
jonahhawk
06-12-2008, 05:26 AM
yup, i've dug through the help and I've read most of those threads.
I don't know how the Maya Mel thread will help me with MXS specifics. I understand what the procedure is:
Define the mesh
Count the faces
For i in 1 to number of faces do
add a particle
set the particle index
set the position of the particle to the position of the face
set the orientation of th eparticle to the normal of the face
I didn't find a polyop.faceTM or anything like that.
Can you see what is wrong with my script in the first post?
Polimeno
06-12-2008, 06:43 AM
yup, i've dug through the help
http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/how_do_i_align_the_uvw_modifier_s_gizmo_to_a_selected_face_.htm
jonahhawk
06-12-2008, 07:05 AM
Thanks for all your help.
Almost there...
http://i99.photobucket.com/albums/l298/jonahhawk/PF_BirthProgress01.jpg
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.usePosition = true
pCont.useTM = true
)
on Init pCont do
(
baseObj = $Sphere01
)
on Proceed pCont do
(
if baseObj != undefined do
(
t = pCont.getTimeStart() as float
NumFaces = getNumFaces baseObj
if t < 0 do
(
for i = 1 to NumFaces do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
polyCenter = (polyop.getFaceCenter baseObj i)
pCont.particlePosition = polyCenter
faceNormal = (in coordsys baseObj polyop.getFaceNormal baseObj i)
worldUpVector = [0,0,1]
rightVector = normalize (cross worldUpVector faceNormal)
upVector = normalize (cross rightVector faceNormal)
theMatrix = matrix3 rightVector upVector faceNormal polyCenter
pCont.particleTM = theMatrix
)
)
)
)
on Release pCont do ()
decapitator
06-12-2008, 08:39 AM
Thanks for all your help.
Almost there...
...You could rotate them the easy way by adding a rotation speed space follow and speed by surface out of normal on a speed like 0.01 in the event and then send out and do the rest of the flow.
jonahhawk
06-12-2008, 09:06 AM
uh... oh yeah... thanks. :) then all I need from the script is the position. I got so caught up in the birth script i fogot about the basics. I learned a bit in the process though. Something is still not right with my little TM calculation.
CGTalk Moderation
06-12-2008, 09:06 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.