stardust_xr_schemas/flat/
tip.rs

1use crate::input_tip::TipT;
2use mint::{Quaternion, Vector3};
3
4/// An input method that represents a single point of interaction, like the tip of a pen or a controller.
5#[derive(Debug, Clone, Copy)]
6pub struct Tip {
7	pub origin: Vector3<f32>,
8	pub orientation: Quaternion<f32>,
9	pub radius: f32,
10}
11impl Default for Tip {
12	fn default() -> Self {
13		Self {
14			origin: Vector3::from([0.0; 3]),
15			orientation: Quaternion::from([0.0, 0.0, 0.0, 1.0]),
16			radius: Default::default(),
17		}
18	}
19}
20
21impl From<TipT> for Tip {
22	fn from(tip: TipT) -> Self {
23		Tip {
24			origin: tip.origin.into(),
25			orientation: tip.orientation.into(),
26			radius: tip.radius,
27		}
28	}
29}
30impl From<Tip> for TipT {
31	fn from(tip: Tip) -> Self {
32		TipT {
33			origin: tip.origin.into(),
34			orientation: tip.orientation.into(),
35			radius: tip.radius,
36		}
37	}
38}