Can I move the animation model's position by passing longitude and latitude to it?

1. A concise explanation of the problem you’re experiencing.

I create a animation model via ‘scene.primitives.add()’, and I add the model to the ‘viewer.entities’ . Now I can receive position data

in real time. I want to move the animation model when receiving the position data.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

(1) create animation model( using the cesium animation demo)

var scene = viewer.scene

var position = new Cesium.Cartesian3.fromDegrees(long, lat) // the position will update in real time

var hpRoll = new Cesium.HeadingPitchRoll()

var fixedFrameTransform = Cesium.Transforms.localFrameToFixedFrameGenerator(‘north’, ‘west’)

var manPrimitive = scene.primitives.add(Cesium.Model.fromGltf({

url: ‘/model/Cesium_Man.gltf’,

modelMatrix: Cesium.Transforms.headingPitchRollToFixedFrame(position, hpRoll, Cesium.Ellipsoid.WGS84, fixedFrameTransform),

minimumPixelSize: 128

}))

manPrimitive.readyPromise.then(function (model) {

// Play and loop all animations at half-speed

model.activeAnimations.addAll({

speedup: 0.5,

loop: Cesium.ModelAnimationLoop.REPEAT

})

})

(2) add to the viewer.entities

let manEntity = viewer.entities.add(new Cesium.Entity({

id: attributes[‘data-id’],

name: ‘miner’,

model: manPrimitive,

position: position,

properties: attributes

}))

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

this is the animation model , I want to move the model to new position when receiving new position data. I need to use it in a real system.

4. The Cesium version you’re using, your operating system and browser.

cesium version: cesium 1.37

operating system: win 10

browser: latest chrome

在 2017年9月21日星期四 UTC+8下午4:24:36,钟寰写道:

Hi,

Using Enity.position and Cartesian3.fromDegrees should be perfect.

manEntity.position = new new Cesium.Cartesian3.fromDegrees(lat, long);

Thanks,

Gabby