Skip to content

ScriptEngine: mousePressOnEntity does not emit when clicking on PolyLine entities #2370

Description

@zedwick

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Script APIScripting API bugs and feature requestsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions