Skip to main content

ManipulateComponent

Class

Handles input information from user touch input via the InteractionComponent to control the Scale, Rotation, and Translation of objects.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Index

Example

// Disables the scale functionality on a manipulate component when a user taps
//@input Component.ManipulateComponent manip

function onTap(eventData)
{
script.manip.enableManipulateType(ManipulateType.Scale, false);
}
var tapEvent = script.createEvent("TapEvent");
tapEvent.bind(onTap);

Extends

Properties

enabled

enabled: boolean

If disabled, the Component will stop enacting its behavior.

Default Value

true

Inherited from

Component.enabled


isBeingDestroyed

readonly isBeingDestroyed: boolean

Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

Since

Lens Scripting Version 364

Example

if (!script.isBeingDestroyed) {
// Component is still fully alive
}

Inherited from

Component.isBeingDestroyed


isContextualSwivel

isContextualSwivel: boolean

Changes swivel behavior based on the object's height relative to the camera.

Default Value

false

isEnabledInHierarchy

readonly isEnabledInHierarchy: boolean

Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

Inherited from

Component.isEnabledInHierarchy


isManipulating

readonly isManipulating: boolean

Returns whether the object that the Manipulate Component is on is currently being manipulated


maxDistance

maxDistance: number

The maximum distance the object can travel from the user.

Default Value

0

maxHeight

maxHeight: number

The maximum height of the object.

Default Value

0

maxScale

maxScale: number

The maximum size the object can scale to.

Default Value

0

minDistance

minDistance: number

The minimum distance the object can be from the user.

Default Value

0

minHeight

minHeight: number

The minimum height of the object.

Default Value

0

minScale

minScale: number

The minimum size the object can shrink to.

Default Value

0

onManipulateEnd

readonly onManipulateEnd: event1<ManipulateEndEventArgs, void>

Event fired when manipulation ends.

Since

Lens Scripting Version 148


onManipulateStart

readonly onManipulateStart: event1<ManipulateStartEventArgs, void>

Event fired when manipulation starts.

Since

Lens Scripting Version 148


rotationScale

rotationScale: number

Multiplier for swivel rotation speed. For example, a value of 0.5 will cut rotation speed in half, and a value of 2.0 will double rotation speed.

Default Value

0

sceneObject

readonly sceneObject: SceneObject

The SceneObject this component is on.

Inherited from

Component.sceneObject


uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Component.uniqueIdentifier

Methods

clampWorldPosition()

clampWorldPosition(): void

Repositions the object to be within the bounds of minDistance, maxDistance.

Returns

void


destroy()

destroy(): void

Destroys the component.

Returns

void

Inherited from

Component.destroy


enableManipulateType()

enableManipulateType(type, enable): void

Enables or disables the specified ManipulateType for this ManipulateComponent.

Parameters

ParameterType
typeManipulateType
enableboolean

Returns

void


getSceneObject()

getSceneObject(): SceneObject

Returns the SceneObject the component is attached to.

Returns

SceneObject

Inherited from

Component.getSceneObject


getTransform()

getTransform(): Transform

Returns the Transform this component is attached to.

Returns

Transform

Inherited from

Component.getTransform


getTypeName()

static getTypeName(): TypeName<ManipulateComponent>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<ManipulateComponent>

Overrides

Component.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Component.getTypeName


intersectManipulateFrame()

intersectManipulateFrame(screenSpacePoint): ManipulateFrameIntersectResult

Checks for an intersection point between the manipulation plane and a line extending from the camera through the specified screen space point. The screen point is passed in as (x, y) with both values ranging from ([0-1], [0-1]), (0,0) being left-top and (1,1) being right-bottom. The result is returned as a ManipulateFrameIntersectResult object.

Parameters

ParameterType
screenSpacePointvec2

Returns

ManipulateFrameIntersectResult


isManipulateTypeEnabled()

isManipulateTypeEnabled(type): boolean

Returns whether the specified ManipulateType is enabled for this ManipulateComponent.

Parameters

ParameterType
typeManipulateType

Returns

boolean


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Component.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Component.isSame