mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Extract 'spacing' variable
This commit is contained in:
parent
15bea26823
commit
019d619cf6
@ -2296,16 +2296,13 @@ impl<'a> AgentData<'a> {
|
||||
self.body,
|
||||
read_data.bodies.get(entity),
|
||||
) {
|
||||
if self.pos.0.xy().distance(pos.0.xy())
|
||||
< body.spacing_radius() + other_body.spacing_radius()
|
||||
{
|
||||
let spacing = body.spacing_radius() + other_body.spacing_radius();
|
||||
if self.pos.0.xy().distance(pos.0.xy()) < spacing {
|
||||
sep_vec += (self.pos.0.xy() - pos.0.xy())
|
||||
.try_normalized()
|
||||
.unwrap_or_else(Vec2::zero)
|
||||
* (((body.spacing_radius() + other_body.spacing_radius())
|
||||
- self.pos.0.xy().distance(pos.0.xy()))
|
||||
/ (body.spacing_radius()
|
||||
+ other_body.spacing_radius()));
|
||||
* ((spacing - self.pos.0.xy().distance(pos.0.xy()))
|
||||
/ spacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user