Created
May 31, 2024 03:46
-
-
Save CoffeeVampir3/51e050aa023ed3c9002a2af051fb3d84 to your computer and use it in GitHub Desktop.
swag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cube_mesh_handle: Handle<Mesh> = meshes.add(Rectangle::new(6., 9.)); | |
let cube_mesh_handle2: Handle<Mesh> = meshes.add(Rectangle::new(6., 9.)); | |
commands.spawn(( | |
SpatialBundle { | |
transform: Transform::default(), | |
..default() | |
}, | |
ParentMarker, | |
// On::<Pointer<Drag>>::listener_component_mut::<Transform>(|drag, transform| { | |
// //transform.rotate_local_y(drag.delta.x / 50.0) | |
// transform.translation.x += drag.delta.x * 0.03; // Make the square follow the mouse | |
// transform.translation.y -= drag.delta.y * 0.03; | |
// }), | |
On::<Pointer<Drag>>::run(drag_3d), | |
)).with_children(|parent| { | |
parent.spawn( | |
PbrBundle { | |
transform: Transform { | |
translation: Vec3::ZERO, | |
scale: Vec3::new(1.0, 1.0, 1.0), | |
..default() | |
}, | |
mesh: cube_mesh_handle, | |
material: materials.add(StandardMaterial { | |
base_color_texture: Some(custom_texture_handle), | |
metallic: 1.0, | |
perceptual_roughness: 1.0, | |
..default() | |
}), | |
..default() | |
}); | |
parent.spawn( | |
PbrBundle { | |
transform: Transform { | |
translation: Vec3::new(0.01, 0.0, 0.0), | |
rotation: Quat::from_rotation_y(std::f32::consts::PI), | |
scale: Vec3::new(1.0, 1.0, 1.0), | |
..default() | |
}, | |
mesh: cube_mesh_handle2, | |
material: materials.add(StandardMaterial { | |
base_color: Color::rgb(0.1, 0.3, 0.7), | |
metallic: 0.7, | |
perceptual_roughness: 0.5, | |
..default() | |
}), | |
..default() | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment