How can I set rotation value with normal Vec3D value?
Hello.
I am working with my new script, and I have problem unsolved with my skill.
I want to create polygon with rotation aligned to normal of other polygon.
I have already these values.
* normal Vec3D value of other polygon.
* each polygon info.
I tried to thise code...
so, how can I culculate these rotation values with normal Vec3D value?
I am so confusing with matrix and rotation culculation.
please, any advice.
Hiroto, tg_jp
Hello.
I am working with my new script, and I have problem unsolved with my skill.
I want to create polygon with rotation aligned to normal of other polygon.
I have already these values.
* normal Vec3D value of other polygon.
* each polygon info.
I tried to thise code...
Code:
// already getting normal for each polygon with normal();
var rot = new Vec3D(Math.atan2(normal.x,normal.z)*180/Math.PI,
Math.atan2(normal.y,normal.z)*180/Math.PI,
Math.atan2(normal.z,normal.x)*180/Math.PI);
var rot = new Mat4D(ROTATE,rot.x,rot.y,rot.z);
// and creating each polygon using rot.multiply([each vertices]) and addVertex();
so, how can I culculate these rotation values with normal Vec3D value?
I am so confusing with matrix and rotation culculation.
please, any advice.
Hiroto, tg_jp
Attachments
Last edited: