feat: parse transform vectors

This commit is contained in:
Nova
2022-09-26 03:32:13 -04:00
parent fdcba63489
commit 2a5c11c0f0
11 changed files with 79 additions and 93 deletions

View File

@@ -4,7 +4,7 @@ use crate::nodes::spatial::{get_spatial_parent_flex, Spatial};
use anyhow::{anyhow, ensure, Result};
use glam::{Mat4, Vec3A};
use portable_atomic::AtomicF32;
use stardust_xr::flex_to_vec3;
use stardust_xr::values::parse_vec3;
use std::sync::atomic::Ordering;
use std::sync::Arc;
@@ -70,7 +70,7 @@ pub fn create_sphere_field_flex(
let node = Node::create(&calling_client, "/field", flex_vec.idx(0).get_str()?, true);
let parent = get_spatial_parent_flex(&calling_client, flex_vec.idx(1).get_str()?)?;
let transform = Mat4::from_translation(
flex_to_vec3!(flex_vec.idx(2))
parse_vec3(flex_vec.idx(2))
.ok_or_else(|| anyhow!("Position not found"))?
.into(),
);