Notifications
Clear all

[Closed] intersecting objects script or tool?

Hey there all,

Maybe this is a little wishful thinking on my part, but is there a script in Max that anyone would care to share that finds intersecting objects in a scene? For instance, I have a scene with a mess of seperate/detached objects and I want to make sure none of them are intersecting or passing through each other?

6 Replies

not sure if theirs a tool or built function to do this*… and it would be terribly slow to use intersect ray… best would be to somehow automate the proboolean tool and check if the intersection of 2 objects gives any geometry, if the intersection of 2 objects results in some geometry then they intersect each other (duh!) (or just implement the algorithm used by proboolean tools (they are quite fast) but i dunno the algorithm it uses 🙁 )

  • this is just my speculation, maybe theres is a tool or built in function for this.

cheers !

interesting thought. I’ll look into the old “Maxscript Help” and see if I can’t figure something out with this. Thanks for the reply!

http://forums.cgsociety.org/showthread.php?f=98&t=850262 <<Bobo goes over some of it in this thread

here’s a quick and dirty (very very slow) way of doing it

(
	st = timestamp()
	select_all = #()
	select_all = geometry
	deselect $*
	for g1 = 1 to select_all.count do
	(	
		for g2 = g1+1 to select_all.count do
		(
			thecopy = copy select_all[g1]
			intersection = thecopy*select_all[g2]
			if (getnumverts intersection) != 0 do
			(
				format "% intersects %
" select_all[g1].name select_all[g2].name
				selectmore select_all[g1]				
				selectmore select_all[g2]	
			)
			delete thecopy			
		)
	)
	actionMan.executeAction 0 "40044"  -- Selection: Select Invert
	if (selection.count>=1) do
		format "selected object does not intersect any other object
"
	et = timestamp()
	format "took % milliseconds 
" (et - st)
)

quick tip * if you just want to check for intersection in your scene you could use a rigid body collection add all the objects to it set all the objects a mass and click on analyze world it will give you a list box showing which objects are interpenetrating (and that is a very very quick way of doing it ) (maybe could marshall data from this listbox using api’s :hmm: )

cheers !

solitude thanks for the reply. I’ve checked this out, but I think Hornberger may have nailed what I was asking for.

Hornberger, your script ended up being really cool and works on small scenes great! And it gives you the time it took. It kind of seems to get stuck if too many objects in the scene though? But maybe if I isolate some objects and do it in chunks instead of all at once. If I do that it works perfectly

Using the reactor utility seemed to really work also, but it kept giving me errors that “geometry is too small?”! But I would have never thought to use that. Thanks for enlightening me on this!

Thanks for your help man!

good to know the script worked …

It kind of seems to get stuck if too many objects in the scene though?

as i mentioned in the earlier its a “dirty (very very slow) way of doing it”. could improve the performance of the script by using distance. but it becomes a tradeof between accuracy and time

but it kept giving me errors that “geometry is too small?

the error don’t matter if all you need is to find out the intersection between the geometry (as intersections b/n geometry is itself treated as an error by the reactor so what you see in the analyse world window is an error screen) and too small geometry error maybe due to voilation of the formula density = mass / volume, again it does not matter, unless you actually want to make a dynamics simulation.

cheers !