THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/06/2011 at 00:58, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I have two objects in the scene..
First one is a surface like polygon object (a landscape).
Second is some other cube or something like that...
What I want to do is that: I want to place second object right on first object's surface.. This is like "align to spline" tag but instead of a spline, I have a plane... i.e. I have a landscape like scene and I have lots of trees and I want to position trees using top view and my script will automatically position trees' Y component to make each of them right on landscape's surface...
I have an algorithm in mind but I have no idea how to implement it.
if COFFEE does have a function which returns the intersection list of an object (with lots of polygon) and a line then:
(x1, y1, z1) = second objects pivot position (I will move pivot of the object to its bottom)
PointList = all geometrical points of first object which intersects with the universal line (X=x1, Z=z1)..
y1 = PointList[0].Y;
if COFFEE does NOT have a function which return intersection of an object and a line then:
(x1, y1, z1) = second objects pivot position (I will move pivot of the object to its bottom)
for each polygon in first object
PointList.add(intersection of current polygon with the universal line (X=x1, Z=z1) )
y1 = PointList[0].Y;
if COFFEE does NOT have a function which finds intersection of a polygon and a line; I will have to write it myself but I do not think that I can do that either
I may have complicated the nature of my problem,
Thank you anyway