API question: raycasting and closest point API?

API question: raycasting and closest point API?

Anonymous
Not applicable
2,544 Views
4 Replies
Message 1 of 5

API question: raycasting and closest point API?

Anonymous
Not applicable

Guys,

Im new to maya but not to cpp dev.

I looked thru the devkit and it seems pretty easy to make custom nodes. but i need some help finding some api classes

mainly: Does maya have a closest point and a raycast api for mesh surfaces.

I need this to implement a node that requires knowledge of surface collision and proximity


thank you in advance.
if this post needs to go someother place in the forum i will thank you
also i dont know what the better listsa nd forums are for serious tehnical questions. so if there are any better ones that i should look at, thanx
dy

0 Likes
2,545 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Any takers?

Array of Point Positions -> Array of Direction Vectors -> Geometry => Array of positions


or


Array of Point Positions -> Geometry => Array of positions? or array of uv values or or or....


is there a way to do this with the MAYA API? Can someone point me to an example and to the necessary clssses


thank you
0 Likes
Message 3 of 5

Anonymous
Not applicable
Hello dyon,

I don't know if Maya has a raycasting library.

I've been developing a set of custom libraries to do this called SceneEngine.

One of these libraries is ScEngRaytrace, which uses a KD-Tree implementation to find intersections between the surface and a ray.

The process is pretty simple. Create the array of vertices and faces, push that into the KD-Tree object and then intersect the KD-Tree with a Ray. If it intersects the mesh, then you get the intersected face id and the distance of such intersection.

The SceneEngine project also includes a Maya plugin you so you can use it as a base to know how to create the faces from your Maya mesh.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi Dyon,

Take a look at MFnMesh function set.

I hope that helps.
0 Likes
Message 5 of 5

syntetik1
Explorer
Explorer

hi dyon, look at MFnMesh class. There are methods for closest point and also ray caster functions closestIntersection, allIntersections etc... Also I would recommend using Accelerator Param for speeding the ray cast. See more in the MFnMesh docs, there is even some example on this.

0 Likes