Skip to main content

Crate realitykit

Crate realitykit 

Source
Expand description

Full RealityKit bindings for Rust — no setup required.

build.rs automatically compiles swift/bridge.swift and links librealitykit_bridge.dylib via realitykit_sys. Just add the crate as a dependency and start using the API — no load_auto() init call is needed anymore.

§Quick start

use realitykit::prelude::*;

// Meshes & materials
let mesh = MeshResource::sphere(0.4);
let mat  = Material::pbr()
    .base_color(0.2, 0.6, 1.0, 1.0)
    .roughness(0.3)
    .build();

// Entities
let ball  = Entity::model(&mesh, &mat).at(0.0, 1.0, 0.0);
let light = Entity::point_light(1.0, 0.95, 0.8, 1200.0, 15.0).at(2.0, 4.0, 2.0);
let floor = Entity::model(&MeshResource::plane(8.0, 8.0),
                          &Material::simple(0.4, 0.4, 0.4));

// Physics
ball.set_physics_body(PhysicsBodyMode::Dynamic, 1.0, 0.5, 0.4);
ball.set_collision_sphere(0.4, 0.0, 0.0, 0.0);
ball.apply_linear_impulse(0.0, 4.0, 0.0);

// Scene (macOS)
let scene  = Scene::new(800.0, 600.0);
let anchor = Entity::anchor(0.0, 0.0, -3.0);
anchor.add_child(&floor).add_child(&ball).add_child(&light);
scene.add_anchor(&anchor);

§Features

  • visionosInputTargetComponent, HoverEffectComponent, PortalComponent, WorldComponent, SurroundingsEffect, hand/head anchors.
  • macos-26BillboardComponent, ForceEffectComponent (WWDC 2025).

§License

GPL-3.0 — Copyright © 2025 Eugene Hauptmann

Re-exports§

pub use entity::Entity;
pub use entity::AnchorType;
pub use entity::PlaneType;
pub use resource::EnvironmentResource;
pub use mesh::MeshResource;
pub use material::Material;
pub use material::MaterialBuilder;
pub use material::TextureResource;
pub use physics::PhysicsBodyMode;
pub use physics::CollisionMode;
pub use animation::AnimationController;
pub use animation::TimingFunction;
pub use animation::AnimationRepeatMode;
pub use animation::AnimationResource;
pub use animation::AnimationDefinition;
pub use audio::AudioResource;
pub use audio::AudioGroupResource;
pub use audio::AudioController;
pub use audio::AudioInputMode;
pub use scene::Scene;
pub use scene::RenderOptions;
pub use scene::RaycastHit;
pub use scene::Subscription;

Modules§

animation
Animation playback controller, timing functions, and animation builders.
audio
Audio resources and playback controllers.
component
Component documentation and re-exports.
entity
Entity — the fundamental scene-graph node in RealityKit.
material
Material types — Simple, Unlit, PhysicallyBased, Occlusion, and Texture.
mesh
Mesh resource creation — all RealityKit primitive generators.
particle
Particle emitter helpers (macOS 14+, iOS 17+, visionOS 1+).
physics
Physics types — PhysicsBodyMode, CollisionMode.
prelude
resource
Resource handles — EnvironmentResource, TextureResource. Re-exported from [material] and [entity] for convenience.
scene
Scene / ARView management — ARView, raycasting, entity queries, event subscriptions.
visionos
visionOS-specific components: InputTargetComponent, HoverEffectComponent, PortalComponent, WorldComponent, SurroundingsEffectComponent, and visionOS-only anchor types (head, left/right hand).

Functions§

load
Backward-compatibility no-op — see load_auto.
load_auto
Backward-compatibility no-op.