JavaFX 3D图形:在3D对象上单击鼠标的位置 [英] JavaFX 3D Graphics: Mouse click position on 3D object

查看:148
本文介绍了JavaFX 3D图形:在3D对象上单击鼠标的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚玩过 Oracle JavaFX Sample 3D图形应用
我想知道是否有可能计算相对于3d平台的
当前鼠标位置
。我想要一些信息,例如如果鼠标悬停3D对象。
是否有可能(以给定的摄像机翻译等方式)?

I just played around with the Oracle JavaFX Sample 3D Graphics app I am wondering if it is possible to calculate the current mouse position relative to the 3d platform. I would like some info e.g. if the mouse hovers a 3d object. Is that possible in any way (Maybe with the given camera translations etc.)?

推荐答案

任何MouseEvent的PickResult类,
只是基本用法..

You can use the PickResult class from any MouseEvent, this is just the basic usage ..

...{
    shape3D.setOnMouseEntered(e->{
        PickResult pr = e.getPickResult();
        System.out.println(pr.getIntersectedPoint());
    });
}

这篇关于JavaFX 3D图形:在3D对象上单击鼠标的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆