Blutz
09-08-2009, 05:03 PM
Hi, I'm new in this forum and in MS too.
I'm writing a script to align sprite on selected faces of a 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.
I'm writing a script to align sprite on selected faces of a 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.
