Added gun sprite

This commit is contained in:
Alexey 2025-07-10 00:14:15 +03:00
commit f1529d7e58
7 changed files with 225 additions and 32 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
*.log
history.bin

View file

@ -0,0 +1,3 @@
(
material_search_options: UsePathDirectly,
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

BIN
data/guns/placeholder.ui Normal file

Binary file not shown.

Binary file not shown.

View file

@ -30,6 +30,9 @@ pub struct Player {
#[reflect(hidden)]
move_right: bool,
#[reflect(hidden)]
reset_position: bool,
#[reflect(hidden)]
yaw: f32,
@ -85,6 +88,9 @@ impl ScriptTrait for Player {
KeyCode::KeyD => {
self.move_right = is_pressed;
},
KeyCode::F1 => {
self.reset_position = is_pressed;
},
_ => (),
}
}
@ -114,6 +120,12 @@ impl ScriptTrait for Player {
}
if let Some(rigid_body) = context.scene.graph.try_get_mut_of_type::<RigidBody>(context.handle) {
if self.reset_position {
rigid_body.local_transform_mut().set_position(Vector3::new(0.0, 0.0, 0.0));
return;
}
let mut velocity = Vector3::new(0.0, 0.0, 0.0);
if self.move_forward {
velocity += look_vector;

View file

@ -489,50 +489,26 @@
),
),
scene_settings: {
"data/scene.rgs": (
"/home/secondbeam/workspace/rust/fyrox/red_dragon_pon/data/guns/placeholder.ui": (
camera_settings: (
position: (0.6421091, 0.11491381, 1.7991738),
yaw: 4.735702,
pitch: 0.11656319,
position: (0.0, 1.0, 0.0),
yaw: 0.0,
pitch: 0.0,
projection: Perspective((
fov: 1.3089969,
z_near: 0.025,
z_far: 128.0,
z_far: 2048.0,
)),
),
node_infos: {
(
index: 45,
index: 0,
generation: 1,
): (
is_expanded: true,
),
(
index: 2,
generation: 1,
): (
is_expanded: true,
),
(
index: 3,
generation: 1,
): (
is_expanded: true,
),
(
index: 46,
generation: 1,
): (
is_expanded: true,
),
(
index: 1,
generation: 1,
): (
is_expanded: true,
),
(
index: 69,
index: 5,
generation: 1,
): (
is_expanded: true,
@ -564,6 +540,12 @@
)),
),
node_infos: {
(
index: 2,
generation: 1,
): (
is_expanded: true,
),
(
index: 1,
generation: 1,
@ -578,16 +560,211 @@
),
},
),
"data/scene.rgs": (
camera_settings: (
position: (0.0, 0.0, 0.0),
yaw: 7.867303,
pitch: 0.41450697,
projection: Perspective((
fov: 1.3089969,
z_near: 0.025,
z_far: 128.0,
)),
),
node_infos: {
(
index: 3,
generation: 1,
): (
is_expanded: false,
),
(
index: 140,
generation: 1,
): (
is_expanded: true,
),
(
index: 0,
generation: 1,
): (
is_expanded: true,
),
(
index: 180,
generation: 1,
): (
is_expanded: true,
),
(
index: 1,
generation: 1,
): (
is_expanded: true,
),
(
index: 49,
generation: 1,
): (
is_expanded: true,
),
(
index: 181,
generation: 1,
): (
is_expanded: true,
),
(
index: 5,
generation: 1,
): (
is_expanded: true,
),
(
index: 53,
generation: 1,
): (
is_expanded: true,
),
(
index: 51,
generation: 1,
): (
is_expanded: true,
),
(
index: 182,
generation: 1,
): (
is_expanded: true,
),
(
index: 139,
generation: 2,
): (
is_expanded: true,
),
(
index: 138,
generation: 2,
): (
is_expanded: true,
),
(
index: 69,
generation: 1,
): (
is_expanded: true,
),
(
index: 47,
generation: 1,
): (
is_expanded: true,
),
(
index: 97,
generation: 1,
): (
is_expanded: true,
),
(
index: 52,
generation: 1,
): (
is_expanded: true,
),
(
index: 46,
generation: 1,
): (
is_expanded: true,
),
(
index: 56,
generation: 1,
): (
is_expanded: true,
),
(
index: 102,
generation: 1,
): (
is_expanded: true,
),
(
index: 2,
generation: 1,
): (
is_expanded: true,
),
(
index: 45,
generation: 1,
): (
is_expanded: true,
),
(
index: 6,
generation: 1,
): (
is_expanded: true,
),
(
index: 57,
generation: 1,
): (
is_expanded: true,
),
(
index: 110,
generation: 1,
): (
is_expanded: true,
),
(
index: 50,
generation: 1,
): (
is_expanded: true,
),
(
index: 109,
generation: 1,
): (
is_expanded: true,
),
(
index: 4,
generation: 1,
): (
is_expanded: true,
),
(
index: 48,
generation: 1,
): (
is_expanded: true,
),
(
index: 54,
generation: 1,
): (
is_expanded: true,
),
},
),
},
recent: (
scenes: [
"data/guns/placeholder.ui",
"data/player.rgs",
"data/scene.rgs",
],
),
windows: (
window_position: (0.0, 0.0),
window_size: (1093.0, 505.0),
window_size: (1896.0, 1024.0),
window_maximized: false,
layout: None,
),