pub struct XrFbRenderModelStepper {
pub left_controller_model_path: String,
pub right_controller_model_path: String,
pub animation_time_code: f32,
pub with_animation: bool,
/* private fields */
}
Expand description
IStepper implementation for XR_FB_render_model integration with StereoKit
This stepper provides controller model rendering and animations using the OpenXR XR_FB_render_model extension. You can configure the model paths for left and right controllers using the public properties or setter methods.
§Events this stepper is listening to:
DRAW_CONTROLLER
- Event that triggers when controller rendering is enabled (“true”) or disabled (“false”).
§Examples
use stereokit_rust::{
tools::xr_fb_render_model::{XrFbRenderModelStepper, is_fb_render_model_extension_available, DRAW_CONTROLLER},
system::{Input, Handed},
prelude::*,
};
// Check if the extension is available before using the stepper
if is_fb_render_model_extension_available() {
let mut stepper = XrFbRenderModelStepper::default();
// Optional: customize controller model paths
stepper.left_controller_model_path = "/model_fb/controller/left".to_string();
stepper.right_controller_model_path = "/model_fb/controller/right".to_string();
// Add the stepper to StereoKit
sk.send_event(StepperAction::add_default::<XrFbRenderModelStepper>("animate_controller"));
// Enable controller rendering
sk.send_event(StepperAction::event("animate_controller", DRAW_CONTROLLER, "true"));
filename_scr = "screenshots/xr_fb_render_model.jpeg"; fov_scr = 45.0;
test_steps!( // !!!! Get a proper main loop !!!!
// The stepper will automatically render controllers with animations
// based on input state (trigger, grip, etc.)
if iter == number_of_steps / 2 {
// Disable controller rendering halfway through
sk.send_event(StepperAction::event("main", DRAW_CONTROLLER, "false"));
}
);
}
§Animation System
The stepper maps controller inputs to specific animation time codes:
- Stick directions: 8 cardinal points (1.18-1.64 range)
- Trigger pressure: Variable animation (0.6-0.66 range)
- Grip pressure: Variable animation (0.82-0.88 range)
- Button combinations: Discrete animations (0.18, 0.32, 0.46, 0.98)
When multiple inputs are active, the step rotation system cycles through
available animations using the animation_time_code
property.
Fields§
§left_controller_model_path: String
Path to the left controller’s render model in the OpenXR runtime Default: “/model_fb/controller/left” (Meta Quest controllers)
right_controller_model_path: String
Path to the right controller’s render model in the OpenXR runtime
Default: “/model_fb/controller/right” (Meta Quest controllers)
animation_time_code: f32
Animation time code for manual control and step rotation system Used in animation_analyser for development and in set_animation for step cycling
with_animation: bool
Controls whether animations are executed in the draw method When false, controllers will be rendered but remain static
Trait Implementations§
Source§impl Default for XrFbRenderModelStepper
impl Default for XrFbRenderModelStepper
Source§impl IStepper for XrFbRenderModelStepper
impl IStepper for XrFbRenderModelStepper
Source§fn enabled(&self) -> bool
fn enabled(&self) -> bool
Source§fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
Source§fn step(&mut self, token: &MainThreadToken)
fn step(&mut self, token: &MainThreadToken)
Source§fn shutdown(&mut self)
fn shutdown(&mut self)
Source§fn shutdown_done(&mut self) -> bool
fn shutdown_done(&mut self) -> bool
Source§fn initialize_done(&mut self) -> bool
fn initialize_done(&mut self) -> bool
impl Send for XrFbRenderModelStepper
Auto Trait Implementations§
impl Freeze for XrFbRenderModelStepper
impl !RefUnwindSafe for XrFbRenderModelStepper
impl !Sync for XrFbRenderModelStepper
impl Unpin for XrFbRenderModelStepper
impl !UnwindSafe for XrFbRenderModelStepper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.