Lab 060 – First look at Manipulation Component

A simple but powerful component to interact with entities in RealityKit.

Introduced in visionOS 26, this component makes interaction a breeze. I’ll add this to the Example Code library once I have time to learn all the details. For now, here are three simple ways to use it.

struct Lab060: View {

    var body: some View {
        RealityView { content in

            guard let scene = try? await Entity(named: "GestureLabs", in: realityKitContentBundle) else { return }
                content.add(scene)

            scene.position.y = -0.4

            if let car = scene.findEntity(named: "ToyCar") {
                // Using the ManipulationComponent defaults
                let mc = ManipulationComponent()
                car.components.set(mc)
            }

            if let rocket = scene.findEntity(named: "ToyRocket") {
                // Changing the release behavior
                var mc = ManipulationComponent()
                mc.releaseBehavior = .stay
                rocket.components.set(mc)
            }

            if let plane = scene.findEntity(named: "ToyBiplane") {
                // Removing translation and scaling
                var mc = ManipulationComponent()
                mc.dynamics.translationBehavior = .none
                mc.dynamics.scalingBehavior = .none
                plane.components.set(mc)
            }

        }
    }
}

Support our work so we can continue to bring you new examples and articles.

Questions or feedback?