Align a sprite to a face
Hi, I'm new in this forum and in MS too.
before post, i use the huge search tool but I don't find my answers.
(I find this but i dont really understand what to do :(
http://www.scriptspot.com/forums/3ds-max/general-scripting/align-object-... )
I'm writing a script to align sprite on selected faces of an object.
But I dont know how to rotate the sprites to align them to the face normal.
A friend talk to me about "quaterion" , I search on internet and MS ref but i'm not familiar with matrix (yes I know, its bad if i want to use MS but I begin ^^ ) so I dont know how to use it well to do what I want.
http://img216.imageshack.us/img216/8509/ms01.jpg
here is the fonction where I start working on my sprite:
function WorkOnSprite FaceID NumID ScaleVar = ( AttaSprite_Copy = copy AttachSprite_Sprite AttaSprite_Copy.name = "Sprite_Face"+FaceID as string+"_"+NumID as string --print ("Sprite copy name : "+AttaSprite_Copy.name) AttaSprite_Copy.scale *= random (1-(ScaleVar/100)) (1+(ScaleVar/100)) --print ("getFaceCenter : "+polyOp.getFaceCenter AttachSprite_Source FaceID as string) --print ("getFaceNormal : "+polyOp.getFaceNormal AttachSprite_Source FaceID as string) --print ("getFaceArea : "+polyOp.getFaceArea AttachSprite_Source FaceID as string) AttaSprite_Copy.pos = polyOp.getFaceCenter AttachSprite_Source FaceID --here i want to rotate the sprite copy to align it with the normal of the face return AttaSprite_Copy )
I'll ask other question but I prefer solve this one first ;)
ps : sorry for my english, I'm a french user.