mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix pet spawning leading to NaN move_dir
Former-commit-id: ac68702bfdb482f32967d96e4b1da2b0ffc4e4c4
This commit is contained in:
parent
3c7f463330
commit
de4d1a0e06
@ -46,7 +46,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Move towards the target.
|
||||
let dist = tgt_pos.distance(pos.0);
|
||||
let dist: f32 = Vec2::from(tgt_pos - pos.0).magnitude();
|
||||
control.move_dir = if dist > 5.0 {
|
||||
Vec2::from(tgt_pos - pos.0).normalized()
|
||||
} else if dist < 1.5 && dist > 0.0 {
|
||||
|
Loading…
Reference in New Issue
Block a user