Hi ,every
I get the feature through the mouse,Then i hope the feature moves along with the mouse. can anyone give me some tips? thank you.
Hi ,every
I get the feature through the mouse,Then i hope the feature moves along with the mouse. can anyone give me some tips? thank you.
Right now a tile’s geometry is static, so it is not possible to move features around. It is an interesting idea though.
thank you very much!I’m involved in an underground gallery project,I found that cesium does not support the underground viewing,then I found a demo in the Forum,https://www.youtube.com/watch?v=vbXf3scNL2E,But I can’t find the source code,can you give me some tips? thank you.
在 2017年11月28日星期二 UTC+8上午7:37:02,Sean Lilley写道:
The code is contained within the html page of the demo, so it might give you some ideas: http://www.hitechmex.org/cesium/Apps/Sandcastle/gallery/EQ_SubSurfaceMODrrV7.html
From a brief glance, it looks like the base globe is the deepest layer and the two higher layers are textured primitives. So this demo is not subsurface in the traditional sense.
I’m not sure what type of app you’re building, but being able to clip a region of terrain and see below the surface will soon be possible in this PR: https://github.com/AnalyticalGraphicsInc/cesium/pull/5996
thank you !I’d like to know more about it. How to get the postion of the pickfeature? i want the camera to move to the selected feature position,I’ll wait for your reply!
在 2017年11月29日星期三 UTC+8上午8:17:53,Sean Lilley写道:
For zooming to a feature you can get the pick position and then move the camera towards it.
Code:
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var scene = viewer.scene;
// Set the initial camera view to look at Manhattan
var initialPosition = Cesium.Cartesian3.fromDegrees(-74.01881302800248, 40.69114333714821, 753);
var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees(21.27879878293835, -21.34390550872461, 0.0716951918898415);
viewer.scene.camera.setView({
destination: initialPosition,
orientation: initialOrientation,
endTransform: Cesium.Matrix4.IDENTITY
});
// Load the NYC buildings tileset.
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url: 'https://beta.cesium.com/api/assets/1461?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYWJmM2MzNS02OWM5LTQ3OWItYjEyYS0xZmNlODM5ZDNkMTYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjFdLCJpYXQiOjE0OTkyNjQ3NDN9.vuR75SqPDKcggvUrG_vpx0Av02jdiAxnnB1fNf-9f7s'
}));
var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function(movement) {
var feature = viewer.scene.pick(movement.position);
if (!Cesium.defined(feature)) {
return;
}
zoom(movement, feature);
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
function zoom(movement, feature) {
var position = scene.pickPosition(movement.position);
var camera = scene.camera;
var heading = camera.heading;
var pitch = camera.pitch;
var offset = offsetFromHeadingPitchRange(heading, pitch, 100.0);
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(position);
Cesium.Matrix4.multiplyByPoint(transform, offset, position);
camera.flyTo({
destination : position,
orientation : {
heading : heading,
pitch : pitch
},
easingFunction : Cesium.EasingFunction.QUADRATIC_OUT
});
}
function offsetFromHeadingPitchRange(heading, pitch, range) {
pitch = Cesium.Math.clamp(pitch, -Cesium.Math.PI_OVER_TWO, Cesium.Math.PI_OVER_TWO);
heading = Cesium.Math.zeroToTwoPi(heading) - Cesium.Math.PI_OVER_TWO;
var pitchQuat = Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Y, -pitch);
var headingQuat = Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Z, -heading);
var rotQuat = Cesium.Quaternion.multiply(headingQuat, pitchQuat, headingQuat);
var rotMatrix = Cesium.Matrix3.fromQuaternion(rotQuat);
var offset = Cesium.Cartesian3.clone(Cesium.Cartesian3.UNIT_X);
Cesium.Matrix3.multiplyByVector(rotMatrix, offset, offset);
Cesium.Cartesian3.negate(offset, offset);
Cesium.Cartesian3.multiplyByScalar(offset, range, offset);
return offset;
}
``
Hi Sean ! thank you very much, If I don’t click the event, I can’t get the pickfeature position. And I found that I couldn’t get the feature if I didn’t click the mouse through the mouse.
for example:
var feature = 3dtileModel._selectedTiles[i]._content._features[j];
I find that the ‘ 3dtileModel._selectedTiles[i]._content._features is undefine’, Is it impossible to get feature without a mouse click event,I’ll wait for your reply!
在 2017年12月5日星期二 UTC+8上午8:48:51,Sean Lilley写道:
Oh I see, so you need to be able to zoom to a feature without actually clicking it. If you already had to click the feature to “select” it, you could save the Cartesian3 returned by pickPosition and use that later when you want to zoom to it.
But if you don’t want to rely on mouse controls at all it gets a little harder. Cesium doesn’t have information about feature positions so it can’t just zoom to a feature yet. We’ve thought about adding bounding volume information to 3D Tiles to achieve this but haven’t tried it yet: https://github.com/AnalyticalGraphicsInc/3d-tiles/issues/127
One way we’ve gotten around this in the past is to store longitude, latitude, and height properties in the batch table of each tile. Then at runtime we can query these properties and find the position of the feature. In order to edit the batch table like this you’ll have to have control over the tool generating your tileset. If you are using someone else’s tool to generate 3D Tiles it may not be possible to do what you want.
Also for you code snippet you should call content.getFeature(j). The variable _features is undefined until there is a call to getFeature.
Hi, sean! I read the recent article on the underground display;Then I also made the appropriate changes to the source code, When looking up, there will be a very right border,How do I hide it?
在 2017年12月6日星期三 UTC+8上午8:00:16,Sean Lilley写道:
Just to be sure, is that an image looking at the underside of terrain or 3D Tiles?
If it’s terrain you can disable the skirts by following the steps here: https://groups.google.com/forum/#!topic/cesium-dev/t6u86rcpN4o