Enemy spawn faces the player (was copying the player's pose -> back turned)
The dummy spawned 120u along the player's forward with the SAME orientation, so both mechs faced the same way and the player stared at its back (also why first shots read as rear hits). Flip the enemy's yaw 180 deg about Y (engine convention: Z basis = (sin y, 0, cos y) -> yaw = atan2(z.x, z.z) + pi) so the two spawn face to face. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
ebeadba78e
commit
a834866fcd
@@ -740,6 +740,14 @@ void
|
||||
enemy_origin.linearPosition.x -= spawnZ.x * 120.0f; // forward = -Z
|
||||
enemy_origin.linearPosition.y -= spawnZ.y * 120.0f;
|
||||
enemy_origin.linearPosition.z -= spawnZ.z * 120.0f;
|
||||
// FACE THE PLAYER: copying the spawn pose left BOTH mechs facing
|
||||
// the same way (the player stared at the enemy's back). Flip the
|
||||
// enemy's yaw 180 deg about Y so the two face each other. Engine
|
||||
// yaw convention (MATRIX.cpp:196-209): the Z basis = (sin y, 0,
|
||||
// cos y) -> yaw = atan2(z.x, z.z); enemy yaw = that + pi.
|
||||
Scalar spawnYaw = (Scalar)atan2((double)spawnZ.x, (double)spawnZ.z);
|
||||
enemy_origin.angularPosition =
|
||||
EulerAngles(0.0f, spawnYaw + 3.14159265f, 0.0f);
|
||||
}
|
||||
|
||||
Mech::MakeMessage
|
||||
|
||||
Reference in New Issue
Block a user