Customize Forge BimWalkExtension keyboard inputs - autodesk-forge

I want to change the keys used in bimwalkExtensions to move in 3D model.
I did not find a method to override keycontrols in the doc
Current configuration

There's no option for overriding for now.

Related

How to do Plain Select

I'm using the Autodesk Forge Viewer with the Edit2D tools to allow the user to draw and modify polygons. I have this working with the polygonTool and polyEditTool. However, I also have a use case where the user needs to be able to select polygons but NOT make any modifications. As far as I can tell, the polyEditTool and moveTool allow the user to select polygons but they also allow them to modify. If I deactivate all tools they can't select, and the standard viewer selection doesn't seem to allow you to select the Edit2D shapes.
How can I get a selection only mode?
The Edit2D extension does not have any built-in option to only enable selection but not editing of shapes, and the workaround you suggested earlier looks reasonable.
Another option to consider would be implementing a custom subclass of EditToolBase (you could use the implementation of the official Edit2D tools as a reference) that would only allow selection, and nothing else.
Ok well it seems a little convoluted but I found a way that seems to work. The move tool allows you to select and move, but each shape has a movable property. If you set movable to false on the shape it can still be selected but can't be moved. So if you are switching between the editing and selection only modes you would have to change that property by iterating over the shapes on the layer and set it each time. Here is my implementation:
for (const shape of state.editor.defaultContext.layer.shapes) {
// #ts-ignore
shape.movable = tool !== DrawTools.Select;
}
Note that TypeScript definitions don't seem to include the movable property so I have to ignore the error.
This seems to work but if there is a better solution out there I would be happy to accept a better answer.

Apply custom appearance to individual model fragments in forge viewer

In the viewable, the model has three leaf nodes that are named “Solid1” but have a parent name of “Tread”, how do I search by parent name to get the dbId?
Following the answer from Default material for model in Forge Viewer I can see that we can set a color. Is it possible to instead apply a texture?
Thanks!
The Viewer has a search() function so you can search for any component based on its properties. You can then go up and down the instance tree to go from Thread to Solid1 or vice versa. See e.g.
https://forge.autodesk.com/blog/selection-override
Yes, you can also use texture for materials. See e.g. https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/blob/master/src/Autodesk.ADN.Viewing.Extension.Material/Autodesk.ADN.Viewing.Extension.Material.js#L273
That code is used in this sample https://forge-rcdb.autodesk.io/configurator?id=58c7ae474c6d400bfa5aaf37
Just enable the "Material" extension by clicking on it, then you will be able to assign textured materials to faces.

How to use the Selection Reticle in CesiumJS

In any of the Cesium sandcastle examples with entities, clicking an entity shows a green square reticle type thing.
My question is, what is it? I want to implement something that behaves similarly but can't find anything about it in the code base or the documentation.
Note: I have disabled the selection widget in my application.
You can see the reticle thing I am talking about in the attached photo.
You mention:
Note: I have disabled the selection widget in my application.
I'm guessing you have a typo or something, because that green reticle is indeed the SelectionIndicator. It can be disabled by setting a constructor option on the Cesium.Viewer, namely:
var viewer = new Cesium.Viewer('cesiumContainer', {
selectionIndicator: false
});
Check your code to see if you really set this option correctly in the constructor.
After the viewer is constructed, it's a bit late to try to turn it off, since it binds into events generated by viewer.selectedEntity changing values. By default, the selectedEntity gets the SelectionIndicator unless the viewer was constructed without one.

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.

How to handle blender's mirror modifier in libgdx

In blender I created a human body using the mirror modifier, so that i had only to model half of the body and the other half would mirror automatically.
However, when I export that model and show in with libgdx, I see only that half. The mirror is missing. And I want to add animations like walking running. So probably, I have to replace the mirror modifier by actual mesh? How?
You should apply your modifieres during the export.
This is the cleanest way cause you don't have to apply all modifieres on every development step of your mesh.
Blender's modifiers are programmed to modify objects in certain ways, don't expect any of them to be available outside of blender. You should always apply any modifiers before trying to share data with other programs.
Every modifier in blender has an apply button that will permanently alter the object to match what the modifier generates.
If you are using several modifiers you may want to use "Convert to Mesh" (press AltC). While this sounds odd when you already have a mesh object, it will apply all modifiers on the object.