maptalks / maptalks/maptalks.three
请问 如何得到点击模型位置的高度呢?
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 650
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
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);
});
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the addGltf function and the baseObjectModel mousemove handler shown in the issue; inspect e.target.intersect and the threeLayer/GLTFLoader integration. Verify whether the intersection data exposes the requested elevation and identify the supported API or example needed. Done means documenting a reproducible way to obtain the clicked model position's height.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, three.js
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100