getting point on mesh surface (2.49b)

Hi,

I am working on a script for placing objects (like trees etc.) on a terrain mesh.
It creates a point cloud within the borders of the selected terrain. Now I want to get the z position of the terrain surface at the x-y position of each point to place the objects there.

I was thinking of something like casting a ray on z-axis of each point and getting the collision point with the terrain, but I could not find anything for this in the API.
But somehow there must be a way, as retopo tools are getting points on surfaces, too. :eek:

I would be happy about any help!

Greetings,
Quen

look into object_drop.py script delivered with Blender

thanks for your answer, migius!
on the first look, it seems to be exactly what I was looking for. thx :slight_smile:

you are welcome. :slight_smile: