xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
726 stars 288 forks source link

Create annotations based on the id of an entity #374

Closed ESiham closed 4 years ago

ESiham commented 4 years ago

Hello, I have an issue, I want to create annotations based on the id of an entity, for example, to create an annotation for a wall I should get the id of this wall and based on this id I should create the annotation, I searched in the Github page but I found that all examples are created with the worldPos, so can someone help me? I would be very grateful.

xeolabs commented 4 years ago

Maybe this example is useful:

https://xeokit.github.io/xeokit-sdk/examples/#annotations_createAtCenterOfClickedObject

In this example, whenever we click on an object, we:

Note that when we click an object multiple times, we create a bunch of annotations at the same worldPos. A useful extension to this example would be to somehow automatically offset the annotations from the object center as they are created, perhaps radially, so that they don't overlap.

Note also that we create each annotation with occludable: false. By default, an annotation's marker and label are hidden when the annotation's position is occluded by something in the 3D view. Since our annotations are created at the center of their objects, we need to configure them occludable: false to disable that occlusion behavior, otherwise they would be constantly occluded by their objects, which would cause their markers and labels to always be hidden.

ESiham commented 4 years ago

thanks @xeolabs for help this is exactly what I am searching for.