File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -171,15 +171,25 @@ pub fn player_movement_system(
171
171
// Déplacement sur l'axe X
172
172
let new_pos_x = player_transform. translation
173
173
+ Vec3 :: new ( direction. x , 0.0 , 0.0 ) * speed * time. delta_seconds ( ) ;
174
- if !check_player_collision ( new_pos_x, & player, & blocks) {
174
+
175
+ if player. is_flying {
175
176
player_transform. translation . x = new_pos_x. x ;
177
+ } else {
178
+ if !check_player_collision ( new_pos_x, & player, & blocks) {
179
+ player_transform. translation . x = new_pos_x. x ;
180
+ }
176
181
}
177
182
178
183
// Déplacement sur l'axe Z
179
184
let new_pos_z = player_transform. translation
180
185
+ Vec3 :: new ( 0.0 , 0.0 , direction. z ) * speed * time. delta_seconds ( ) ;
181
- if !check_player_collision ( new_pos_z, & player, & blocks) {
186
+
187
+ if player. is_flying {
182
188
player_transform. translation . z = new_pos_z. z ;
189
+ } else {
190
+ if !check_player_collision ( new_pos_z, & player, & blocks) && !player. is_flying {
191
+ player_transform. translation . z = new_pos_z. z ;
192
+ }
183
193
}
184
194
}
185
195
You can’t perform that action at this time.
0 commit comments