Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTEXT with directionVector can get wrong Z rotation #31

Open
tampiland opened this issue Sep 30, 2024 · 0 comments
Open

MTEXT with directionVector can get wrong Z rotation #31

tampiland opened this issue Sep 30, 2024 · 0 comments

Comments

@tampiland
Copy link

I noticed that some of my text elements appeared upside down in threejs compared to my CAD software. I've tried to review the code, and I believe that line 334 in index.js always produces positive angles, when half of them should be negative.

if (entity.directionVector) {
    var dv = entity.directionVector
    textEnt.rotation.z = new THREE.Vector3(1, 0, 0).angleTo(new THREE.Vector3(dv.x, dv.y, dv.z))
}

Line 334 in index.js

I believe a simple sign multiplication with the Y-component would do the trick.

if (entity.directionVector) {
    var dv = entity.directionVector
    textEnt.rotation.z = new THREE.Vector3(1, 0, 0).angleTo(new THREE.Vector3(dv.x, dv.y, dv.z)) * Math.sign(dv.y)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant