Giter VIP home page Giter VIP logo

Comments (2)

javagl avatar javagl commented on June 15, 2024

This repository is for the 3D Tiles format specification. Issues here should be about the specification itself. If you have questions about rendering (3D Tiles) with CesiumJS, you should ask them in the CesiumJS section of the Cesium Community Forum.


But to at least try to give a first hint: Just assigning a color to a picked object will not change the color of a rendered object. What you are trying to accomplish can probably be done with styling. A basic example is shown here:

viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) {
  const pickedObject = viewer.scene.pick(movement.endPosition);
  console.log('pickedObject:');
  console.log(pickedObject);
  if (!Cesium.defined(pickedObject)) {
    return;
  }
  const content = pickedObject.content;
  if (!Cesium.defined(content)) {
    return;
  }
  if (!(content instanceof Cesium.Model3DTileContent)) {
    return;
  }
  const style = new Cesium.Cesium3DTileStyle({
    color: "color('red')"
  });
  content.applyStyle(style);
  
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

It will apply the given style (which just colors an object in 'red') to the elements that you are hovering with the mouse. Further examples of styling can be found in the Sandcastle at https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Styling.html . More detailed or specific questions should be discussed in the forum.

from 3d-tiles.

HerculesJL avatar HerculesJL commented on June 15, 2024

This repository is for the 3D Tiles format specification. Issues here should be about the specification itself. If you have questions about rendering (3D Tiles) with CesiumJS, you should ask them in the CesiumJS section of the Cesium Community Forum.

But to at least try to give a first hint: Just assigning a color to a picked object will not change the color of a rendered object. What you are trying to accomplish can probably be done with styling. A basic example is shown here:

viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) {
  const pickedObject = viewer.scene.pick(movement.endPosition);
  console.log('pickedObject:');
  console.log(pickedObject);
  if (!Cesium.defined(pickedObject)) {
    return;
  }
  const content = pickedObject.content;
  if (!Cesium.defined(content)) {
    return;
  }
  if (!(content instanceof Cesium.Model3DTileContent)) {
    return;
  }
  const style = new Cesium.Cesium3DTileStyle({
    color: "color('red')"
  });
  content.applyStyle(style);
  
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

It will apply the given style (which just colors an object in 'red') to the elements that you are hovering with the mouse. Further examples of styling can be found in the Sandcastle at https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Styling.html . More detailed or specific questions should be discussed in the forum.

thank you very much!

from 3d-tiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.