fix npc aiming and shooting

This commit is contained in:
2025-11-17 16:10:10 -03:00
parent f24736ed73
commit 18a799b151
2 changed files with 2 additions and 2 deletions

View File

@@ -127,7 +127,7 @@ fn rotate(agent: Query<(Entity, &Engage)>, mut transform: Query<&mut Transform>)
};
// Get the direction vector from the current position to the target
let direction = (target_pos - agent_transform.translation).normalize();
let direction = (agent_transform.translation - target_pos).normalize();
// Project the direction onto the XZ plane by zeroing out the Y component
let xz_direction = Vec3::new(direction.x, 0.0, direction.z).normalize();