Hi all,
I would really like to know how to check whether the mouse is hovering over an entity.
Rgds,
Hi all,
I would really like to know how to check whether the mouse is hovering over an entity.
Rgds,
You could attach collision component to that entity (eg. simple box sorrounding that entity) and then use raycasting to check if you are hovering over that entity with mouse:
var self = this;
var from = this.camera.camera.screenToWorld(e.x, e.y, this.camera.camera.nearClip);
var to = this.camera.camera.screenToWorld(e.x, e.y, this.camera.camera.farClip);
var result = this.app.systems.rigidbody.raycastFirst(from, to);
if (result && result.entity == this.entity) {
// do smthing
}