I need to reproduce what the shrinkwrap modifier does but without creating geometry.
I have an xml containing a list of locations "Seat" (x,y,z) in world space and I need to loop through them projecting each one, (only in z axis) onto a mesh given by an object. Once they are projected I need to rewrite the xml with the new locations.
So, I'm struggling with the raycast, I manage to make it work but I really don't understand what I'm doing, let me show you what I have right now:
def conformHeight(tree, filename):
for venue in tree:
for Sector in venue.findall('Sector'):
for Seat in Sector:
# Get Position Data
posX, posY, posZ = float(Seat.get('px')), float(Seat.get('py')), float(Seat.get('pz'))
obj = bpy.context.object
def ray_cast():
location = obj.ray_cast(posZ, (0.0, 0.0, 1.0))
return location
loc = ray_cast()
print(loc)
In the ray_cast() I'm not sure where to add the selected object over which I want to project the locations neither to get in return the hit locations.
I have searched all over the internet and all the info I find is very confusing as mostly refers to camera ray tracing.
How should the function be written?