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

Method vectoangles

qcommon/src/main/java/jake2/qcommon/util/Math3D.java:140–170  ·  view source on GitHub ↗
(float[] value1, float[] angles)

Source from the content-addressed store, hash-verified

138 return yaw;
139 }
140 public static void vectoangles(float[] value1, float[] angles) {
141
142 float yaw, pitch;
143
144 if (value1[1] == 0 && value1[0] == 0) {
145 yaw = 0;
146 if (value1[2] > 0)
147 pitch = 90;
148 else
149 pitch = 270;
150 }
151 else {
152 if (value1[0] != 0)
153 yaw = (int) (Math.atan2(value1[1], value1[0]) * 180 / Math.PI);
154 else if (value1[1] > 0)
155 yaw = 90;
156 else
157 yaw = -90;
158 if (yaw < 0)
159 yaw += 360;
160
161 float forward = (float) Math.sqrt(value1[0] * value1[0] + value1[1] * value1[1]);
162 pitch = (int) (Math.atan2(value1[2], forward) * 180 / Math.PI);
163 if (pitch < 0)
164 pitch += 360;
165 }
166
167 angles[Defines.PITCH] = -pitch;
168 angles[Defines.YAW] = yaw;
169 angles[Defines.ROLL] = 0;
170 }
171 private static float m[][] = new float[3][3];
172 private static float im[][] = new float[3][3];
173 private static float tmpmat[][] = new float[3][3];

Callers 15

testMapMethod · 0.95
thinkMethod · 0.95
thinkMethod · 0.95
touchMethod · 0.95
fire_leadMethod · 0.95
fire_blasterMethod · 0.95
fire_grenadeMethod · 0.95
fire_grenade2Method · 0.95
fire_rocketMethod · 0.95
fire_bfgMethod · 0.95
thinkMethod · 0.95

Calls

no outgoing calls

Tested by 1

testMapMethod · 0.76