From 1ea2b28ca445ffc74f1a4790714aa53ec54d0836 Mon Sep 17 00:00:00 2001 From: Adam Spindler Date: Wed, 7 Jul 2021 10:11:12 -0700 Subject: [PATCH] Expose Raycaster object in TransformControls (#22070) * Expose Raycaster object in TransformControls * Rename getSharedRaycater() to getRaycaster() Co-authored-by: Adam Spindler --- docs/examples/en/controls/TransformControls.html | 8 ++++++++ docs/examples/ko/controls/TransformControls.html | 7 +++++++ docs/examples/zh/controls/TransformControls.html | 7 +++++++ examples/js/controls/TransformControls.js | 6 ++++++ examples/jsm/controls/TransformControls.js | 6 ++++++ 5 files changed, 34 insertions(+) diff --git a/docs/examples/en/controls/TransformControls.html b/docs/examples/en/controls/TransformControls.html index 1ba151d6587d22..c1d9c7325590e4 100644 --- a/docs/examples/en/controls/TransformControls.html +++ b/docs/examples/en/controls/TransformControls.html @@ -161,6 +161,14 @@

[method:null dispose] ()

Should be called if the controls is no longer required.

+

[method:Raycaster getRaycaster] ()

+

+ Returns the [page:Raycaster] object that is used for user interaction. This object is shared between all instances of + TransformControls. If you set the [page:Object3D.layers .layers] property of the [name], you will also want to + set the [page:Raycaster.layers .layers] property on the [page:Raycaster] with a matching value, or else the [name] + won't work as expected. +

+

[method:String getMode] ()

Returns the transformation mode. diff --git a/docs/examples/ko/controls/TransformControls.html b/docs/examples/ko/controls/TransformControls.html index 77bceca47dbbef..afd28cf85cadad 100644 --- a/docs/examples/ko/controls/TransformControls.html +++ b/docs/examples/ko/controls/TransformControls.html @@ -159,6 +159,13 @@

[method:null dispose] ()

컨트롤을 더이상 필요하지 않을 경우 호출해야 합니다.

+

[method:Raycaster getRaycaster] ()

+

+ 사용자 상호 작용에 사용되는 [page:Raycaster] 객체를 반환합니다. 이 개체는의 모든 인스턴스간에 공유됩니다. TransformControls. [name] 의 + [page:Object3D.layers .layers] 속성을 설정하면 [page:Raycaster] 의 [page:Raycaster.layers .layers] 속성을 일치하는 + 값으로 설정하거나 그렇지 않으면 [name] 예상대로 작동하지 않습니다. +

+

[method:String getMode] ()

변환 모드를 반환합니다. diff --git a/docs/examples/zh/controls/TransformControls.html b/docs/examples/zh/controls/TransformControls.html index 219a9c32336989..76f7156dc64fbb 100644 --- a/docs/examples/zh/controls/TransformControls.html +++ b/docs/examples/zh/controls/TransformControls.html @@ -160,6 +160,13 @@

[method:null dispose] ()

若不再需要该控制器,则应当调用此函数。

+

[method:Raycaster getRaycaster] ()

+

+ 返回用于用户交互的 [page:Raycaster] 对象。 此对象在所有实例之间共享 变换控件。 如果您设置 [name] 的 + [page:Object3D.layers .layers] 属性,您还需要 使用匹配值设置 [page:Raycaster] 上的 + [page:Raycaster.layers .layers] 属性,否则设置 [name] 不会按预期工作。 +

+

[method:String getMode] ()

返回变换模式。 diff --git a/examples/js/controls/TransformControls.js b/examples/js/controls/TransformControls.js index 214032b6ae6c82..1f8300ea12fd8c 100644 --- a/examples/js/controls/TransformControls.js +++ b/examples/js/controls/TransformControls.js @@ -551,6 +551,12 @@ this.axis = null; return this; + } + + getRaycaster() { + + return _raycaster; + } // TODO: deprecate diff --git a/examples/jsm/controls/TransformControls.js b/examples/jsm/controls/TransformControls.js index f98892f0971e42..9ab0296b488042 100644 --- a/examples/jsm/controls/TransformControls.js +++ b/examples/jsm/controls/TransformControls.js @@ -586,6 +586,12 @@ class TransformControls extends Object3D { } + getRaycaster() { + + return _raycaster; + + } + // TODO: deprecate getMode() {