Compare commits
3 commits
d0937d7949
...
21e6cedfff
Author | SHA1 | Date | |
---|---|---|---|
21e6cedfff | |||
a967f71b61 | |||
1cefe2d8b5 |
5 changed files with 16 additions and 3 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
# braille_xr
|
||||
# color_cube
|
||||
|
||||
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,6 +1,7 @@
|
|||
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},
|
||||
|
@ -20,7 +21,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.005
|
||||
Vec3::from(h.index.tip.position).distance(Vec3::from(h.thumb.tip.position)) < 0.0075
|
||||
}
|
||||
// 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,
|
||||
|
@ -93,6 +94,18 @@ 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