
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
can you use percent % in maxscript? If not is there a substitude aproach?
I saw this question asked on the internet which matched my question.
"Is there any way to find out if a point is inside/intersecting a cylinder with a defined radius and height rotated in any direction?"
A response was given below that does not use maxscript but it uses % which I was hoping could point me in the right direction. I dont think mascript lets you use them. I am not even sure what they are.
Would I need to them in order to use maxscript and mascript normals and vector math to solve my problem?
thanks
function isInCylinder(%pos, %radius, %height, %normal, %point)
{
%normal = vectorNormalize(%normal); // just in case
%dist = mAbs(vectorDot(%point, %normal) - vectorDot(%pos, %normal)); // perp. dist. from plane of bottom circle to point
%point2 = vectorAdd(%point, vectorScale(%normal, -%dist));
if(%dist > %height || vectorDist(%pos, %point2) > %radius)
return false;
return true;
}
Solved! Go to Solution.