better value for "up" vector
This commit is contained in:
parent
e9afeefb7d
commit
bfad39613e
|
@ -563,6 +563,7 @@ fn handle_wants_lookat(
|
|||
mut query: Query<(
|
||||
&Position,
|
||||
&mut Rotation,
|
||||
&Transform,
|
||||
&mut ExternalTorque,
|
||||
&WantsToLookAt,
|
||||
)>,
|
||||
|
@ -576,7 +577,7 @@ fn handle_wants_lookat(
|
|||
return;
|
||||
};
|
||||
|
||||
for (pos, mut rot, mut _torque, target_id) in &mut query {
|
||||
for (pos, mut rot, trans, mut _torque, target_id) in &mut query {
|
||||
let target_pos = if target_id.0 == cmd::ID_SPECIAL_PLAYERCAM {
|
||||
player_pos
|
||||
} else if let Some(target_pos) = id2pos.0.get(&target_id.0) {
|
||||
|
@ -584,7 +585,7 @@ fn handle_wants_lookat(
|
|||
} else {
|
||||
continue;
|
||||
};
|
||||
rot.0 = look_at_quat(**pos, *target_pos, DVec3::Y);
|
||||
rot.0 = look_at_quat(**pos, *target_pos, trans.up().as_dvec3());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue