[Closed] matrix question
i am writing a script to distribute a some objects over a deforming mesh (by bend for example) so i wrote that script :
num=getnumverts $root
for i in 1 to num do
(
b=teapot radius:2 box:true
b.transform.controller=transform_script()
theobj=$root
b.transform.controller.addnode "obj" theobj
txt="snapshotasmesh obj
"
txt+="thenormal=(getnormal obj "+i as string +")
"
txt+="thex=normalize (cross thenormal obj.dir)
"
txt+="they=normalize (cross thenormal thex)
"
txt+="matrix3 thex they thenormal (getvert obj "+i as string+")
"
b.transform.controller.script=txt
)
what i surprisingly had was the flipping at some point, i wonder if i can avoid that
what do mean by flipping? as I see from your code the Z axis always looks at the same direction as face normal. Spinning is expected, but flipping can’t take a place.
ok to get wat i mean try to create plane and execute this code -you may change the name of the plane in the code- to distribute teapots on the plane , then apply bend modifier on the plane animate it over time , wat wiill get is the teapots at from zero at one direction and once one frame more it flips !!!
i wish i can fix this
don’t trust the getnormal function. It doesn’t return right vertex normal value sometimes. Use face normals…
here s a the max file its max2011 you can see wat i mean by the teapot direction
http://rapidshare.com/files/423033303/test.max
ok , even though the same result still there , i am really eager to get that stubborn result no matter what ,