fix npc aiming and shooting
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user