GetNormals / GetFaceNormal simple Question


#1

Good Evening,
I have several Questions regarding Rotation and Normals in 3ds Max. Any help would be appreciated :slight_smile:

(1) The first one would be when i try to disply my Normal direction through a Helper Object I dont understand why it gets Positioned where it gets Positioned. (GetNorm) is in this regards the same I excpect that the Normals at least if its the Vertex Normals will be aligend with the Normals shown through the Edit Normal Modifer (with a high size). I hope its somehow clear where i lack understanding.

point02 = (getFaceNormal myMesh 5)
p2 = point pos:point02

To clearify it a bit more
fn faceNormalTester myO = ( --TEST TO CHECK WHERE MY FACE NORMALS ARE IN THE SCENE

myFaces = polyop.getNumFaces myO

for fa = 1 to myFaces do
(
	fNormal = polyop.getFaceNormal myO fa node:true
	p3 = point pos:fNormal name:(fa as string)
)

)
this function with my Editable Poly creates enough Points, but positiones them all near the 0,0,0 Position in the World and in theory they should get created on my Testobject (i use a simple cube)

โ€“this one works as excpected

point01 = myRay.pos // ray object
p2 = point pos:point01


#2

I kind of solved my Problen in using polyop.getFaceCenter for my script but still im kind of confused about what exactly happens with getFaceNormal


#3

Normal is a vector. It has only direction. For your point helper if you get normal of a vertex, then use the vertex position, if you get normal of a face - use the polyop.getFaceCenter or polyop.getSafeFaceCenter to place the point helper properly.


#4

:man_facepalming: Thanks year it makes sense


#5

your code only requires a small change

myFaces = polyop.getNumFaces myO

for fa = 1 to myFaces do
(
	fCenter = polyop.getFaceCenter myO fa node:true
	fNormal = polyop.getFaceNormal myO fa node:true
	p3 = point dir:fNormal pos:fCenter name:(fa as string)
)

#6

Itโ€™s excellent!
if we want to get the normals of the vertices you can give us an example?
thank you.


#7

Thanks appreciate it. It makes totally sense to use the FaceCenter and Normal as direct :stuck_out_tongue:


#8

Get vertex normal from Editable Poly here they talk about ur problem. I think this will help you

local sel = selection[1]
local vertFaces = polyOp.getFacesUsingVert sel (polyOp.getVertSelection sel as array)[1]
local tNormal = [0,0,0]; for i in vertFaces do tNormal += polyOp.getFaceNormal sel i
tNormal / vertFaces.numberSet  -- code by light August 2005