GeOnDT GeOnDT for JS

Class: UGizmoControls

UGizmoControls

~extends TransformControls
3d 객체의 위치·회전·크기를 편집하는 기즈모 컨트롤.
대상 객체가 attach된 동안에만 포인터 이벤트를 수신하고, 드래그 중에는 앱의 현재 카메라 컨트롤을 비활성화한다.

new UGizmoControls(opt)

Name Type Default Description
opt UGizmoControlsCO {} optional

생성 옵션

Methods

attach(object)

대상 객체를 연결하고 포인터 이벤트 수신을 시작한다.

Name Type Description
object Object3D

편집 대상 객체

Returns:
대상이 연결된 이 컨트롤 자신. 부모 계약이 this 타입이므로 반환 타입은 추론에 맡긴다.

detach()

대상 객체를 분리하고 포인터 이벤트 수신을 중단한다.

Returns:
대상이 분리된 이 컨트롤 자신. 부모 계약이 this 타입이므로 반환 타입은 추론에 맡긴다.

getMode()string

현재 변환 모드를 반환한다.

Returns:
Type Description
string 'translate' | 'rotate' | 'scale'

pointerDown(pointer)

포인터가 눌리면 기즈모 평면과의 교차 여부로 제어 중 상태를 갱신한다.

Name Type Description
pointer UGizmoControlsPointer | null

정규화 좌표와 버튼 정보

pointerUp(pointer)

포인터가 떼어지면 제어 중 상태를 해제한다.

Name Type Description
pointer UGizmoControlsPointer | null

정규화 좌표와 버튼 정보

setMode(mode)

변환 모드를 지정한다.

Name Type Description
mode string

'translate' | 'rotate' | 'scale'

setPosition(world)

기즈모의 위치를 지정한다.

Name Type Description
world Vector3Like

기즈모를 놓을 월드 좌표

updateMatrixWorld(force)

대상 객체가 scene graph에서 제거되었으면 기즈모를 분리하고, 아니면 부모의 갱신을 수행한다.

Name Type Description
force boolean optional

부모 갱신 여부와 무관하게 강제 갱신할지 여부

Type Definitions

UGizmoControlsCOobject

UGizmoControls 생성자 옵션

Properties:
Name Type Argument Default Description
camera Camera <optional>

기즈모 투영에 사용할 카메라

domelement HTMLElement <optional>

포인터 이벤트를 수신할 DOM 요소

app U3dApp <optional>

소속 앱. 드래그 중 현재 카메라 컨트롤을 비활성화하고 변경 시 렌더링을 요청한다. 없으면 오류 메시지를 남긴다.

size number <optional>
1.5

기즈모 헬퍼 UI 크기

UGizmoControlsPointerobject

TransformControls가 포인터 이벤트에서 추출해 전달하는 포인터 정보

Properties:
Name Type Description
x number

NDC x 좌표 (-1 ~ 1)

y number

NDC y 좌표 (-1 ~ 1)

button number

눌린 포인터 버튼