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

请问 如何得到点击模型位置的高度呢? #646

Open
lzp0070007 opened this issue Sep 11, 2024 · 0 comments
Open

请问 如何得到点击模型位置的高度呢? #646

lzp0070007 opened this issue Sep 11, 2024 · 0 comments

Comments

@lzp0070007
Copy link

lzp0070007 commented Sep 11, 2024

function addGltf() {
clock = new THREE.Clock();
stats = new Stats();
map.getContainer().appendChild(stats.dom);
var loader = new THREE.GLTFLoader();
loader.load('./data/alien.gltf', function (gltf) {

            model = gltf.scene;
            model.rotation.x = Math.PI / 2;
            model.scale.set(100, 100, 100);

            baseObjectModel = threeLayer.toModel(model, { coordinate: map.getCenter() });
            // model.position.copy(threeLayer.coordinateToVector3(map.getCenter()));
            threeLayer.addMesh(baseObjectModel);
            baseObjectModel.on('mousemove', e => {

                //这里能否在e 得到 点击位置的高程值???
                const target = e.target;
                const intersect = target.intersect;
                //do some things
                if (intersect && intersect.object && intersect.object.material) {
                    intersect.object.material.color.set('red');
                }
            })

            // createGUI(model, gltf.animations);
            animate();

        }, undefined, function (e) {

            console.error(e);

        });
    }
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