本文へスキップ

オービットコントロールズ

説明

このコンポーネントを使用すると、エンティティの周りを制約で周回することができます。

プロパティ

プロパティタイプデフォルト説明
speednumber5How fast the camera moves
maxAngularSpeednumber10Max rotation speed of the camera
maxZoomSpeednumber10Max zoom speed for the camera
distanceMinnumber5Minimum distance between the focused entity and the camera
distanceMaxnumber20Maximum distance between the focused entity and the camera
pitchAngleMinnumber-90Minimum pitch angle
pitchAngleMaxnumber90Maximum pitch angle
constrainYawbooleanfalseWhether to constrain yaw
yawAngleMinnumber0Minimum yaw angle
yawAngleMaxnumber0Maximum yaw angle
inertiaFactornumber0.3Inertia factor for camera movement
invertedXbooleanfalseWhether controls for moving on x-axis are inverted
invertedYbooleanfalseWhether controls for moving on y-axis are inverted
invertedZoombooleanfalseWhether controls for zooming in and out are inverted
controllerSupportbooleanfalseWhether to support controllers via the input-manager
verticalSensitivitynumber1Input sensitivity vertically
horizontalSensitivitynumber1Input sensitivity horizontally
focusEntityeidundefinedFocus subject for the orbit camera

機能

Get

Returns a read-only reference.

Example

ecs.OrbitControls.get(world, component.eid)

Set

Ensures the component exists on the entity, then assigns the (optional) data to the component.

Example

ecs.OrbitControls.set(world, component.eid, {
speed: 5,
maxAngularSpeed: 10,
maxZoomSpeed: 10,
distanceMin: 5,
distanceMax: 20,
pitchAngleMin: -90,
pitchAngleMax: 90,
constrainYaw: false,
yawAngleMin: 0,
yawAngleMax: 0,
inertiaFactor: 0.3,
invertedX: false,
invertedY: false,
invertedZoom: false,
controllerSupport: false,
verticalSensitivity: 1,
horizontalSensitivity: 1,
focusEntity: undefined
})

Mutate

Perform an update to the component within a callback function. Return true to indicate no changes made.

Example

ecs.OrbitControls.mutate(world, component.eid, (cursor) => {
cursor.speed = 2;
cursor.maxAngularSpeed = 3;
return false;
})

Remove

Removes the component from the entity.

Example

ecs.OrbitControls.remove(world, component.eid)

Has

Returns true if the component is present on the entity.

Example

ecs.OrbitControls.has(world, component.eid)

Reset

Adds, or resets the component to its default state.

Example

ecs.OrbitControls.reset(world, component.eid)

Advanced Functions

Cursor

Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.

Example
ecs.OrbitControls.cursor(world, component.eid)

Acquire

Same behavior as cursor, but commit must be called after the cursor is done being used.

Example
ecs.OrbitControls.acquire(world, component.eid)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.OrbitControls.commit(world, component.eid)
ecs.OrbitControls.commit(world, component.eid, false)

Dirty

Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.

Example
ecs.OrbitControls.dirty(world, component.eid)