Ok I got it working, it returns the same cords as my own script, I guess my error is from some other oversight on my own part, (even when the hitPoint changes, the UV cord does not change unless the face does)
http://www.pasteall.org/65387/python any more help should take place here, http://blenderartists.org/forum/showthread.php?393329-Convert-Mono-to-Py&p=3015344#post3015344 as I don't want to spam the mailing list. On Sat, Feb 27, 2016 at 12:41 AM, tristan panzer < [email protected]> wrote: > The first triangle is a the position of each vertexes and the second the > position of each UV. > > 2016-02-27 9:40 GMT+01:00 Jacob Merrill <[email protected]>: > > > looked at it - the command says it's for using 2 triangles to do > something, > > > > It does not accept UV as the second argument. > > > > On Sat, Feb 27, 2016 at 12:34 AM, Jacob Merrill < > > [email protected]> > > wrote: > > > > > must have missed it > > > > > > > > > On Sat, Feb 27, 2016 at 12:32 AM, tristan panzer < > > > [email protected]> wrote: > > > > > >> Hello, > > >> > > >> uv = mathutils.getUVFromTri([p1,p2,p3],[uv1,uv2,uv3],[point]) > > >> > > >> Can be replaced by; > > >> > > >> uv = mathuttils.geometry.barycentric_transform(point, p1, p2, p3, uv1, > > >> uv2, > > >> uv3) > > >> > > >> > > >> > > > https://www.blender.org/api/blender_python_api_2_76_release/mathutils.geometry.html?highlight=mathutils#mathutils.geometry.barycentric_transform > > >> > > >> iirc i already sent you this link, it is wrong ? > > >> > > >> 2016-02-27 7:48 GMT+01:00 Jacob Merrill <[email protected]>: > > >> > > >> > I have been using BVHTree.rayCast, and it returns a hitPoint, but > not > > a > > >> > hitUV, > > >> > > > >> > so to extract this information I have been using python and have > tried > > >> > transcribing a old unity script, it kinda works, but could we have > > this > > >> as > > >> > a feature of BVHtree or as a seperate mathutils command? it seems > > >> important > > >> > to add features like python based texture painting. > > >> > > > >> > > > >> > > > >> > *idea 1 *= add UV return to BVHtree or a command UVBVHTree function > > for > > >> > texture painting in python, without slowing down bvhTree. > > >> > > > >> > > > >> > > > >> > > > >> > *idea 2:* > > >> > *get Uv from triangle and point on triangle plane as mathutils > > command* > > >> > > > >> > uv = mathutils.getUVFromTri([p1,p2,p3],[uv1,uv2,uv3],[point]) > > >> > > > >> > where p1 , p2, and p3 are triangle vertex location vectors, and uv1 > > etc > > >> > area the uv cord for each point, point = the area you would like to > > get > > >> a > > >> > UV from. > > >> > > > >> > referances - http://stackoverflow.com/a/17186533/1979851 > > >> > > > >> > > > >> > > > >> > > > >> > *idea 3 * > > >> > uv = > mathutils.getUVFromQuad([p1,p2,p3,p4],[uv1,uv2,uv3,uv4],[point]) > > >> > > > >> > > > >> > - same as triangle but for use with a quad rather than trying to > > >> split 2 > > >> > triangles from a quad. > > >> > > > >> > > > >> > Thanks! > > >> > BPR > > >> > _______________________________________________ > > >> > Bf-committers mailing list > > >> > [email protected] > > >> > http://lists.blender.org/mailman/listinfo/bf-committers > > >> > > > >> _______________________________________________ > > >> Bf-committers mailing list > > >> [email protected] > > >> http://lists.blender.org/mailman/listinfo/bf-committers > > >> > > > > > > > > _______________________________________________ > > Bf-committers mailing list > > [email protected] > > http://lists.blender.org/mailman/listinfo/bf-committers > > > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
