简体   繁体   中英

Forge viewer: Auto-start animation

We would like to trigger/auto-start an animation/simulation of a specific object (Revit ElementID ) when the model loads in the Forge viewer. The goal would be to move a cube (Revit ElementID ) back and forth on the floor in a repeating loop. Would this be possible using any relevant extension or code?

Yes it is possible but there is no built-in extension you can use out of the box. The animation logic has to be a custom implementation.

From a given ElementId/UniqueId you need to find the corresponding dbId, see that reply for a starting point on how to do that.

From a given dbId, you can obtain fragmentIds and use those to apply transforms to the components in the viewer. The animation logic has to be by your own application. You can refer to that article How to create animations in the viewer? or one of the several demos I wrote performing animations:

Kinematics - source

Physics - source

You can use the Autodesk.Viewing.GEOMETRY_LOADED_EVENT and Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT to trigger the animation logic, so you can make sure the model is fully loaded. See also that article: Asynchronous viewer events notification .

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM