Get Model from ModelGraphics

225 views
Skip to first unread message

niklas...@enplore.com

unread,
Nov 29, 2018, 12:29:27 PM11/29/18
to cesium-dev
I'm looking to dig deeper into a 3D model which I'm using as an entity (ModelGraphics). I'm looking to both handle built-in animations on a fine grained level, as well as possibly setting properties on nodes (using getNode). However it doesn't seem to be possible on ModelGraphics.

Based on https://groups.google.com/forum/#!searchin/cesium-dev/model$20modelgraphics|sort:date/cesium-dev/QEwwG3F8bTA/nRMqDavaDwAJ the suggestion seem to be to use nodeTransformations.

So I guess my questions are:

1. Is there any legitimately way to reach the Model behind a ModelGraphics (assuming there is one)
2. Would it be better to use a Model instead of ModelGraphics, but if I understand it correctly you can't add a Model to the entities via `viewer.entities.add` (at least I can't manage it, and I think I've read that it's impossible)

Or is the most future-proof way to use nodeTransformation on the ModelGraphics? I'm perfectly fine with that, it seems super powerful.

The reason I am asking is mainly that it's no use for me to pay someone from adding several animations into the 3d model itself if the best way is to use nodeTransformation :)

As always, thank you for Cesium. A super awesome product and tool. Thank you everyone who makes it possible.

Regards,
Niklas

Omar Shehata

unread,
Dec 3, 2018, 12:20:16 PM12/3/18
to cesium-dev
I actually ran into this myself just today while trying to dynamically control the speed of an animation. I had to add a new property on ModelGraphic to control that:


I was contemplating whether it would be worth exposing Model from the Entity API. If you want to experiment with that, you can see how a ModelGraphics on the Entity level is associated with the Model primitive if you go to the update function in Source/DataSources/ModelVisualizer.js. It keeps a `modelHash` object which links entities to models. 

The popular VSCode glTF extension does use the Model instead I believe for this reason, and you can see how it handles animations here:


But you're right, then you won't be able to use viewer.entities.add.

We're definitely open to suggestions here, and I think this is a good use case. This might be a good opportunity to open a feature request on GitHub (https://github.com/AnalyticalGraphicsInc/cesium/issues) to ask if Model can be exposed through the entity API to make these manipulations more straightforward.

Niklas B

unread,
Dec 4, 2018, 3:00:14 AM12/4/18
to cesiu...@googlegroups.com
Thank you for the super helpful pointers, I will make sure to add a feature request!

Regards,
Niklas

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/4wVIah9ZAuk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages