MCPcopy Create free account
hub / github.com/demoth/jake2 / vectoangles2

Method vectoangles2

client/src/main/java/jake2/client/CL_ents.java:1057–1087  ·  view source on GitHub ↗
(float[] value1, float[] angles)

Source from the content-addressed store, hash-verified

1055 ======
1056 */
1057 static void vectoangles2 (float[] value1, float[] angles) {
1058 float forward;
1059 float yaw, pitch;
1060
1061 if (value1[1] == 0 && value1[0] == 0) {
1062 yaw = 0;
1063 if (value1[2] > 0)
1064 pitch = 90;
1065 else
1066 pitch = 270;
1067 } else {
1068 // PMM - fixed to correct for pitch of 0
1069 if (value1[0] != 0)
1070 yaw = (float) (Math.atan2(value1[1], value1[0]) * 180 / Math.PI);
1071 else if (value1[1] > 0)
1072 yaw = 90;
1073 else
1074 yaw = 270;
1075
1076 if (yaw < 0)
1077 yaw += 360;
1078
1079 forward = (float) Math.sqrt (value1[0] * value1[0] + value1[1] * value1[1]);
1080 pitch = (float) (Math.atan2(value1[2], forward) * 180 / Math.PI);
1081 if (pitch < 0)
1082 pitch += 360;
1083 }
1084 angles[0] = -pitch;
1085 angles[1] = yaw;
1086 angles[2] = 0;
1087 }
1088
1089 // add client side clipping
1090 static trace_t CL_Trace (float[] start, float[] end, float size, int contentmask) {

Callers 1

CalcViewValuesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected