Class

EntityTranslationGestureRecognizer

A gesture recognizer that uses a pan gesture to move an entity.

Declaration

@objc class EntityTranslationGestureRecognizer : UIGestureRecognizer

Topics

Creating a Translation Gesture Recognizer

init(target: Any?, action: Selector?)

Creates a translation gesture recognizer with a target instance and an action selector.

Specifying the Entity

var entity: HasCollision?

The entity on which the recognizer operates.

Recognizing Touches

func touchesBegan(Set<UITouch>, with: UIEvent)

Tells the recognizer that the user has touched the entity with one or more fingers.

func touchesMoved(Set<UITouch>, with: UIEvent)

Tells the gesture recognizer when one or more fingers move in the associated view.

func touchesCancelled(Set<UITouch>, with: UIEvent)

Tells the gesture recognizer that a system event (such as an incoming phone call) cancels a touch event.

func touchesEnded(Set<UITouch>, with: UIEvent)

Tells the gesture recognizer when one or more fingers lift from the associated view.

Characterizing Movement

func translation(in: Entity?) -> SIMD3<Float>?

Gets the translation of the gesture in the space of the specified entity.

func setTranslation(SIMD3<Float>, in: Entity?)

Sets the translation of the gesture in the given entity’s coordinate space.

func velocity(in: Entity?) -> SIMD3<Float>

Gets the velocity of the translation gesture in the space of the specified entity.

func location(in: Entity?) -> SIMD3<Float>?

Gets the location of the translation gesture in the space of the specified entity.

Resetting State

func reset()

Resets internal state when a gesture recognition attempt completes.

See Also

Adding Gesture Recognizers to Entities

func installGestures(ARView.EntityGestures, for: HasCollision) -> [EntityGestureRecognizer]

Installs standard gestures onto the given entity, configured to be recognized simultaneously.

struct ARView.EntityGestures

The set of possible entity gesture recognizers.

func gestureRecognizer(UIGestureRecognizer, shouldRecognizeSimultaneouslyWith: UIGestureRecognizer) -> Bool

Determines whether two gesture recognizers should simultaneously recognize a gesture.

class EntityRotationGestureRecognizer

A gesture recognizer that uses rotation gestures involving two touches to rotate a given entity.

class EntityScaleGestureRecognizer

A gesture recognizer that uses a pinch gesture to scale or zoom an entity.

protocol EntityGestureRecognizer

An type of gesture recognizer that works on entities.