Im haveing a bit of a problem with the mathutils. intersect function- as you can see I have created a triangle with a line going through it- verts are marked - it is clearly intersecting, yet when I call the intersect function it returns none… would someone mind looking at the code below to see where I may be going wrong
import Blender
from Blender import *
from Blender import Mathutils
from Blender.Mathutils import *
import bpy
from bpy import *
scn = bpy.data.scenes.active
obj = scn.objects.active
me = obj.getData(False, True)
Vec1=me.verts[0].co
Vec2=me.verts[1].co
Vec3=me.verts[2].co
Vec4=me.verts[3].co
Vec5=me.verts[4].co
print Intersect(Vec1,Vec2,Vec3,Vec4,Vec5, 1)
This does the intersection of a Triangle and a Ray, which has an origin and a direction.
So basically you would need to define argument 5 as the origin, which in this case is either Vec4 or Vec5. The “ray”, which is the direction, is the vector from vec4 to vec5 or vice versa if using vec5 as the origin.
So saying we picked vec4 as the origin, ray would be vec5-vec4, and your call would look like:
Intersect(Vec1, Vec2, Vec3, Vec5-Vec4, Vec4, 1)
If we pick vec5 as the ray’s origin, then it looks like:
oooooooh!!, I get it- so ray is the direction the line is moving in and in this case wil end up being something like 0,-1,0 … that makes sense thanks!!