mousePressOnEntity, mouseReleaseOnEntity, hoverEnterEntity, hoverLeaveEntity, etc. do not emit when a polyline is clicked. I think it would be helpful to be able to interact with PolyLine entities.
I would like to be able to act when the user clicks on a PolyLine. My use case is for Visual Scripting, as I use PolyLines to draw connections between nodes; The user would be able to delete an existing connection by clicking on the connection (poly)line.
@HifiExperiments:
the ray intersection logic just isn’t implemented for polylines. we could add a basic bounding box check which would make them clickable, or eventually the proper intersection logic against the actual line
|
type == EntityTypes::PolyLine || type == EntityTypes::Sound || type == EntityTypes::Script || type == EntityTypes::Empty || |
I have created a script for testing:
mousePressOnPolyLineEntity.js
Add this as an interface script, it will then create a PolyLine entity near you with a client entity script running on it which aims to:
- Change the line color to green when pressed
- Change the line color to red when released
- Change the line color to blue when hovering over it, and white when no longer hovering over it.
I have tested the client entity script as working with a simple cube entity, so should work when PolyLines have support for those events.
mousePressOnEntity,mouseReleaseOnEntity,hoverEnterEntity,hoverLeaveEntity, etc. do not emit when a polyline is clicked. I think it would be helpful to be able to interact with PolyLine entities.I would like to be able to act when the user clicks on a PolyLine. My use case is for Visual Scripting, as I use PolyLines to draw connections between nodes; The user would be able to delete an existing connection by clicking on the connection (poly)line.
@HifiExperiments:
overte/libraries/entities/src/EntityTreeElement.cpp
Line 202 in 26a7de4
I have created a script for testing:
mousePressOnPolyLineEntity.js
Add this as an interface script, it will then create a PolyLine entity near you with a client entity script running on it which aims to:
I have tested the client entity script as working with a simple cube entity, so should work when PolyLines have support for those events.