Transforming RealityKit entities using gestures

In the section : Add transform logic to the main component

There is the line : var state: GestureStateComponent = entity.gestureStateComponent ?? GestureStateComponent()

When I try to add the same line. I have the error cannot find GestureStateComponent in scope.

My imports : import SwiftUI import RealityKit import RealityKitContent

An answer would be greatly appreciate it

Answered by DTS Engineer in 835329022

GestureStateComponent is not part of any framework, is there are particular sample code you are referencing? If so, that sample code likely defines this type, so you would need to include that type definition in your project.

Inside the let flippedRotation. There is a Rotation3D(angle: rotation.angle. But rotation is also not in scope.

This error message is telling you that you don't have a property in-scope named "rotation".

-- Greg

In addition to the post :

Inside the let flippedRotation. There is a Rotation3D(angle: rotation.angle.

But rotation is also not in scope. I don't understand where these rotation come from and how to get them in scope

GestureStateComponent is not part of any framework, is there are particular sample code you are referencing? If so, that sample code likely defines this type, so you would need to include that type definition in your project.

Inside the let flippedRotation. There is a Rotation3D(angle: rotation.angle. But rotation is also not in scope.

This error message is telling you that you don't have a property in-scope named "rotation".

-- Greg

Transforming RealityKit entities using gestures
 
 
Q