mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/fix-sliding' into 'master'
Fixed incorrect velocity snapping on collision See merge request veloren/veloren!1909
This commit is contained in:
commit
606dea022b
@ -1059,13 +1059,12 @@ fn box_voxel_collision<'a, T: BaseVol<Vox = Block> + ReadVol>(
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// Correct the velocity
|
// Correct the velocity
|
||||||
vel.0 = vel.0.map2(resolve_dir, |e, d| {
|
vel.0 = vel.0.map2(
|
||||||
if d * e.signum() < 0.0 {
|
resolve_dir,
|
||||||
if d < 0.0 { d.min(0.0) } else { d.max(0.0) }
|
|e, d| {
|
||||||
} else {
|
if d * e.signum() < 0.0 { 0.0 } else { e }
|
||||||
e
|
},
|
||||||
}
|
);
|
||||||
});
|
|
||||||
pos_delta *= resolve_dir.map(|e| if e != 0.0 { 0.0 } else { 1.0 });
|
pos_delta *= resolve_dir.map(|e| if e != 0.0 { 0.0 } else { 1.0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user