Notifications
Clear all

[Closed] maxscript to automate some borring processes

First of all I ‘ve no idea about scripting but starting to think about it more and more becasue…
Because of doing same thing in max almoust every day. Wer’re doing arch viz and basically it’s making building and then putting a lot of trees, cars and people inside. I was trying to think about some methods to automate some processes. So I though about max script.Is it enough powerfull to do something like this:
let’s say I’m selecting all driveways where I want to have cars and it puts them automaticly there properly alligned, then I want trees and flowers on grass select faces and it puts randomly trees and flowers. Same thing about people on pavewalks and so. So is it possible to write this kind of scripe in max?

7 Replies
1 Reply
(@tuomasj)
Joined: 10 months ago

Posts: 0

I would do those kinds of things with particle instances with pflow. Just use emitter density map for trees and flowers. So you dont need maxscript if you dont want to.

I Hope this helps

Yes, MAXScript is very powerfull and sure it will create some trees and flowers automaticly for you. All you have to do is learn scripting language.:eek: I’m also MAXScript beginner but I’ll recomend CG Academy’s MAXScript DVDs. Laszlo and Bobo will explane what is all about.

Link: CG Academy

With some creative use of maxscript and the scatter tool you shouldn’t have too much difficulty.

Maxscript isn’t hard to learn (I say this from a programming background though!), just follow the basic tutorials in the helpfile and you’ll be up and running. For the most part anything you want to work out can be done by looking up the reference. If it still eludes you, come talk to the forum! The amount of amzing help I’ve received for maxscript here has been invaluable.

I’ve started to learn And it’s amazing that it’s so easy. Ofcurse I need a lot of practise to remmeber all the commands but at least I understand everything
About my problem. I’m just courious how put it in maxscript thay all objects I’m scattering will be watching for example not to intersect the walls and other objects. You know what I mean?

Unfortunally, I think there are no collision detection methods in maxscript (?).
and to code it yourself is probably pretty difficult…

But I have already programmed a script to put a forest and to avoid the collisions between trees I have used this very simple method:
I create manually an object with vertices in the top view, and the script multiply the number of points itself (for to avoid to put 10000 vertex manually lol)
And next, the script weld vertices too close (with Weld function).
I use the function ‘intersectRayEx’ to find the ground.
The script mixes itself various sorts of trees according to different percentages.

So you draw the positions of the trees using vertices and there are not collision with the bulding and the weld function avoid the overlaping…

If you are interested, I can show you the code but I do not think that he can work directly in your case.

First, there is the Intersects function which will test the nodes at bounding box level.
If it returns true, you can then perform additional checks – one cool method is to perform a boolean intersection of the two objects’ meshes and check the resulting mesh – if it has any vertices, the two objects intersect!

fn collisionDetection node1 node2 =
 (
 	if intersects node1 node2 then 
 		(node1.mesh * node2.mesh).numverts > 0
 	else
 		false
 )
 
 collisionDetection $Box01 $Box02 --returns true if the two boxes intersect, false otherwise
 
 

Thank you very much almighty Bobo