Created
September 4, 2015 12:18
-
-
Save JokerMartini/8315b480f617ab927cec to your computer and use it in GitHub Desktop.
Maxscript: Demonstrates how to use Pflow to generate points on polygonal nodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _genPFPts = #() | |
fn GenPFPoints nodes:undefined amount:10 location:4 = | |
( | |
_genPFPts = #() | |
pfp = PF_Source name:"pf_points" X_Coord:0 Y_Coord:0 Quantity_Viewport:100 Show_Logo:off Show_Emitter:off | |
particleFlow.BeginEdit() | |
op1 = Birth name:"pfp_birth" amount:amount Emit_Stop:currenttime Emit_Start:currenttime | |
op2 = Position_Object name:"pfp_place" Emitter_Objects:nodes Location:location Lock_On_Emitter:on Random_Seed:(random 1 1000000000) | |
source = "" | |
source += "on ChannelsUsed pCont do (pCont.usePosition = on) \n" | |
source += "on Proceed pCont do for k=1 to pCont.NumParticles() do\n" | |
source += " _genPFPts[pCont.particleIndex = k] = pCont.particlePosition\n" | |
op3 = Script_Test name:"pfp_test" Proceed_Script:source | |
ev1 = Event name:"pfp_event" | |
ev1.AppendAction op1 | |
ev1.AppendAction op2 | |
ev1.AppendAction op3 | |
pfp.AppendInitialActionList ev1 | |
particleFlow.EndEdit() | |
particleFlow.delete pfp | |
return _genPFPts | |
) | |
surfaces = #(box()) | |
-- collect points using pflow to distrubte on selected faces | |
points = GenPFPoints nodes:surfaces amount:50 | |
for p in points do | |
( | |
point pos:p | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment