brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
809 stars 102 forks source link

Unable to highlight vertices in ribbon #268

Closed harit-m-kumar closed 1 year ago

harit-m-kumar commented 1 year ago

I am working with creating a ribbon on a terrain. I need the vertices to be highlighted and clickable to be dragged and expanded.

      {this.vectors.length > 0 &&
          <ribbon
            key={this.changeIndex} //important
            name="main"
            diffuceColor={new Color3(1, 0, 0)}
            //For plane and points change, uncomment below line and comment paths line
            pathArray={[this.vectors]}
            //pathArray={[this.path1,this.path2,this.path3,this.path4]}
            closeArray={true}
            closePath={true}
            //enablePointerMoveEvents={true}
            useVertexColors={true}
            enablePointerMoveEvents={true}
            //enableEdgesRendering={true}  //to show edges

<pointerDragBehavior //dragButtons={[1,2]} //dragging={true} currentDraggingPointerID={this.currentPos} dragPlaneNormal={new Vector3(0, 1, 0)} validateDrag={this.validateDrag} //useVertexColors={true} //moveAttached={true} />

            <standardMaterial
              alpha={0.4}
              backFaceCulling={true}
              // ambientColor={new Color3(1, 0.5, 0.7)}
              diffuseColor={this.planeColor}
              name="material1"
              wireframe={true}
            ></standardMaterial>
          </ribbon>
        }

Tried the above snippet, is there any way by which we can highlight the vertices to make it expandable via dragging?

brianzinn commented 1 year ago

I think you would need a custom material. This is a better question for the babylon forum - you'd need to make an imperative version of above as a playground and definitely that's be best way to get advice is from the community. if you follow up here then I'm happy to work on a declarative version with you.

brianzinn commented 1 year ago

actually, you can maybe get usable code from Gizmo as well - depends on your use case.

brianzinn commented 1 year ago

closing from inactivity. please re-open if you would like to discuss further.