Compare commits
No commits in common. "21e6cedfffac3aa6e673862d6495f149e56eba47" and "d0937d7949fb14267ac258588d39305ce0613cbd" have entirely different histories.
21e6cedfff
...
d0937d7949
5 changed files with 3 additions and 16 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
# color_cube
|
||||
# braille_xr
|
||||
|
||||
xyz -> rgb
|
||||
|
||||
color picker that you can move around in a color_cube
|
||||
° color picker that you can move around in a color_cube
|
||||
|
||||
when you pull the color picker out of the cube it will pick colors from your environment
|
||||
while showing you where that color is in the color_cube
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,6 @@
|
|||
use glam::Vec3;
|
||||
use stardust_xr_fusion::drawable::{MaterialParameter, Model, ModelPart, ModelPartAspect};
|
||||
use stardust_xr_fusion::input::InputMethodAspect;
|
||||
use stardust_xr_fusion::spatial;
|
||||
use stardust_xr_fusion::{
|
||||
client::{Client, FrameInfo},
|
||||
core::values::{rgba_linear, Color, ResourceID},
|
||||
|
@ -21,7 +20,7 @@ fn is_grabbing(input: &InputData) -> bool {
|
|||
match &input.input {
|
||||
InputDataType::Hand(h) => {
|
||||
// hands have pinch_strength and grab_strenght data but i figured you should know how to get raw joints
|
||||
Vec3::from(h.index.tip.position).distance(Vec3::from(h.thumb.tip.position)) < 0.0075
|
||||
Vec3::from(h.index.tip.position).distance(Vec3::from(h.thumb.tip.position)) < 0.005
|
||||
}
|
||||
// pointers and tips (tips are like controllers, pens, spatial cursors) have datamaps full of abstract actions (e.g. select) and raw input info
|
||||
_ => input.datamap.with_data(|d| d.idx("select").as_f32()) > 0.9,
|
||||
|
@ -94,18 +93,6 @@ impl ColorCube {
|
|||
if is_grabbing(data) {
|
||||
// call this method when you want to make sure the hand is only trying to interact with this handler
|
||||
method.request_capture(&self.handler).unwrap();
|
||||
|
||||
// let tr = self.field.get_relative_bounding_box(&self.field);
|
||||
let point_pos = interact_point(data);
|
||||
let bound_pos = Vec3::new(
|
||||
point_pos.x.clamp(-0.1, 0.1),
|
||||
point_pos.y.clamp(-0.1, 0.1),
|
||||
point_pos.z.clamp(-0.1, 0.1),
|
||||
);
|
||||
let pos = (bound_pos * 10.0) + Vec3::new(0.5, 0.5, 0.5);
|
||||
self.hover_color = rgba_linear!(1.0 - pos.x, pos.y, 1.0 - pos.z, 1.0);
|
||||
|
||||
let _ = self.circle.set_local_transform(Transform::from_translation(bound_pos));
|
||||
}
|
||||
// then check every frame until it is successfully captured (but it might not be ever)
|
||||
if data.captured {
|
||||
|
|
Loading…
Add table
Reference in a new issue