It might just be that I'm not totally thinking straight it's 4am, however I'm working on some scripts for a project and was wondering if anyone knows how I could lets say duplicate a mesh in my max file to a new location in the same scene. I have a mesh in my file called "box01" and an array of x,y,z coords. I'd like to be able to duplicate this mesh and move it to a location based on one of the elements in the array.
Coords are returned as [x,y,z]
Mesh names aren't important because I'm attaching them all to a single mesh before exporting it all.
Thanks
Replies
I think this function should do the trick, for more info look in the help as always Found this by using the listener, it actually is helpfull sometimes :P
I hope this was what you were looking for.
http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/interface_maxops.htm
search on that page for 'CloneNodes'
example code:
[php]--Clone the source.
result = #()
--Instanced copy.
maxOps.cloneNodes object_to_clone_here offset:[0,0,0] expandedHierarchy:true cloneType:#instance actualNodeList:#() newNodes:&result
the_result = result[1][/php]
http://www.3dbuzz.com/vbforum/showthread.php?t=86499
Have you checked out Neil Blevins Object Replacer script? Probably does what you need it to, if not could have some handy insight.
here is a function doing the job. Works with Editable Poly and Mesh. Gets an object and an array of Point3 and clones the source to specified positions, then attaches them to the source.
You may want to look to this thread discussing how to speed up attachment of a large number of objects.
/saved =P
@SyncViewS, thanks for the function, unfortunately for what I'm applying the functionality to it isn't really what I need. But seeing how to structure the resulting array and all that was a big help.
I'm writing a script which takes in all the gameplay telemetry from our student game project and turning it into a visual representation our level designers can toss into their maps in UnrealEd to get a better idea of the player path and player's use of our mechanics. I'll be posting in a few days to get some help turning it into a lean mean script.
Basically I get a log file from the game which after being parsed and reformatted by a simple perl script looks something like this:
LEVELSTART&
PLAYERSPAWN&
102092.01,3741.62,-64822.92,HEAVY&
102092.02,3741.63,-64964.61,HEAVY&
102092.05,3741.67,-65389.59,HEAVY&
CAMERARESET&
102092.06,3741.70,-66097.70,LIGHT&
102092.10,3741.71,-66524.59,LIGHT&
102092.09,3741.72,-66666.93,LIGHT&
PLAYERDEATH&
...
102092.01,3741.62,-64822.92,HEAVY&, this is basically the player's x,y,z, and state. Our game has three states, HEAVY, LIGHT, and NORMAL. it just allows us to see where the player is switching between the states.
LEVELSTART&, PLAYERSPAWN&, CAMERARESET&, PLAYERDEATH&, and a few others are simply events which occur.
So what I do is create a new spline and add knots at the player location every line. Every time the state changes I start a new spline with a new materialID. (This allows for different colouring in the game version) Also there is a set of simple geometry which relates to the different states and all the different events. These get placed when the event happens at the last known player location.
Being a student and all I'd be curious to know how much of this kind of thing actually gets done during the production stage of a game being developed by industry professionals.
Cheers all!
-Evan