Skip to content
Snippets Groups Projects
Unverified Commit e5cf97d1 authored by David Sehnal's avatar David Sehnal Committed by GitHub
Browse files

Merge pull request #217 from sukolsak/fix-cylinder

Fix cylinder orientation
parents d185c0ef 1844fc14
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ function setCylinderMat(m: Mat4, start: Vec3, dir: Vec3, length: number, matchDi ...@@ -31,6 +31,7 @@ function setCylinderMat(m: Mat4, start: Vec3, dir: Vec3, length: number, matchDi
// ensure the direction used to create the rotation is always pointing in the same // ensure the direction used to create the rotation is always pointing in the same
// direction so the triangles of adjacent cylinder will line up // direction so the triangles of adjacent cylinder will line up
if (matchDir) Vec3.matchDirection(tmpUp, up, tmpCylinderMatDir); if (matchDir) Vec3.matchDirection(tmpUp, up, tmpCylinderMatDir);
else Vec3.copy(tmpUp, up);
Mat4.fromScaling(tmpCylinderMatScale, Vec3.set(tmpCylinderScale, 1, length, 1)); Mat4.fromScaling(tmpCylinderMatScale, Vec3.set(tmpCylinderScale, 1, length, 1));
Vec3.makeRotation(tmpCylinderMatRot, tmpUp, tmpCylinderMatDir); Vec3.makeRotation(tmpCylinderMatRot, tmpUp, tmpCylinderMatDir);
Mat4.mul(m, tmpCylinderMatRot, tmpCylinderMatScale); Mat4.mul(m, tmpCylinderMatRot, tmpCylinderMatScale);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment