Skip to content

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

@lzp0070007

Description

@lzp0070007

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

        });
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions